Affichage des articles dont le libellé est DAX. Afficher tous les articles
Affichage des articles dont le libellé est DAX. Afficher tous les articles

jeudi 4 avril 2019

DAX, Using Colors names instead of Hex Code


Yesterday, I read a blog post from Matt Allington where he presented a way to apply conditional formatting with a Text field (not a numeric field) "Conditional Formatting with a Text Field in Power BI".

I really loved the possibility of using Color names, in DAX Measures, instead of Hex code, but a question remained "Is there a list of all valid colors names that I can use in DAX Measures?"

After some search on the web I was not able to find that list. So, I started to randomly try some colors names, I found on web pages like "99Colors" or "Farb-Tabelle", some of them worked but not the majority and what I ended up with is that:
  • A valid name must not contain spaces."DarkBlue" is valid but not "Dark Blue".
  • The color name is not case sensitive DarkBlue and darkblue both will work.
  • ALL the basic colors (black, red, green, …) worked find.
This last point, and because I'm coming from Excel, give me an idea, why not trying the Excel colors enumeration known as XLRgbColors and guess what, all of them worked fine except "NavyBlue".

Continuing my tests, I find that:
  • Some colors have two names, Gray and Grey, DarkGray and DarkGrey, DarkSlateGray and DarkSlateGrey, DimGray and DimGrey, LightGray and LightGrey, LightSlateGray and LightSlateGrey.
  • NavyBlue is listed with another name which is Navy.
  • Five other colors worked for me event if they are not listed in the XLRgbColor Enumeration, Magenta (listed as Fuchsia) Cyan (listed as Aqua), Chocolate, Rebecca Purple and SaddleBrown so maybe you will be able to find more colors that work just let me know.
Now I have a list of 148 colors names that I can use in DAX measures instead of hex code and you can find them by downloading this .csv file by following this link.

PS: I finally was able to figure out what is the reference for that names list and it is the CSS3 Color Names.

#powerbi #dax

mardi 5 février 2019

DAX : Calculer une moyenne journalière avec la fonction VALUES par Jen-Pierre Girardot

Jean-Pierre Girardot (aka Power BI Academy) revient ce mois-ci avec un exemple sympa qui permet de bien comprendre l'utilisation de la fonction VALUES()

dimanche 3 février 2019

MSPTDA 19: CALCULATE DAX Function & Filter Context & ALLSELECTED & KEEPF...

Mike Girvin (aka ExceklIsFun) est de retour avec une nouvelle vidéo dans laquelle il explore un notion fondamentale de DAX le contexte de filtre.

Il présente aussi la fonction DAX "CALCULATE" qui est la seule fonction DAX à pouvoir changer le contexte de filtre.

mercredi 9 janvier 2019

Ranking by Multiple Columns (Guest Post by BI Elite) on Havens Consulting Youtube Channel

This a guest video post from Parker over at BI Elite where Parker explains how to use DAX to create a ranking based on multiple columns.

lundi 24 décembre 2018

DAX : Comment saisir le nom d'une table dans une mesure


Normalement, si vous avez besoin de faire référence à une table de votre modèle dans une mesure DAX, il suffit de saisir les premiers caractères de celles-ci et l'IntelliSense fait le reste et vous propose le nom de la table puis la liste des colonnes précédées du nom de la table. Il ne vous restera plus qu'à cliquer sur le nom de la table ou de la colonne appropriée.

Toutefois, si le nom de votre table contient un caractère accentué ou un espace, DAX met systématiquement le nom de la table entre apostrophes, il vous faudra donc dérouler la liste jusqu'à arriver aux valeurs qui commence par une apostrophe (')
Donc pour saisir le nom d'une table surtout si celle-ci contient une espace ou un caractère accentué, commencez votre saisie par une apostrophe ainsi l'IntelliSense filtrera la liste pour ne garder que la liste des tables et de leurs champs.

Remarque importante :

Je vous aurez bien conseillé de systématiquement commencer la saisie du nom de vos tables par une apostrophe car l'IntelliSense renvoie aussi les tables qui ne contiennent ni espaces ni caractères accentués mais Marco Russo (SQLBI.com) recommande justement, dans un article intitulé "Rules for DAX Code Formatting", de ne pas mettre d'apostrophes pour les tables qui ne nécessitent pas cela.

mardi 29 mai 2018

Measures vs Calculated Columns by Reza Rad


A just read an interesting article posted by Reza Rad 06 months ago on RADACAD blog about a question that is always comming back

What is the differences between Measures and Calculated Columns, in DAX, and when using the first one or the Second ?

So if you are interested just follow this link : http://radacad.com/measure-vs-calculated-column-the-mysterious-question-not

mercredi 23 mai 2018

Debug DAX using Variables in Power BI

I encourage you to view this stupefiant video.

You will learn, from Marco Russo, how to use variables to debug DAX formula on a example provided by Patrick.



Remember this sentence from Marco, "If it's not formated, it's not DAX" :)