Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Dear Community,
I currently work out on the tooltips and chg the color according to the %.
My calculation part is correct, but I having issues on this VAR to chg the color. For example, the calc part is negative, suppose it will show red color. But this code has total up two year and change it to green. Is that possible to add on the year filter in this VAR code?
KPI color Previos19_20_A =
VAR Green = "#056608"
VAR Red = "#CB0525"
VAR Result = IF([Diff % previos month_2020_A] >=0, Green, Red)
Return
Result
Many thanks!
Hi @NickProp28 ,
It is difficult to find the problem from the picture you provided,the dax is right. could pls provide your pbix file ? Remember to remove the confidential information.
Best Regard
Lucien Wang
@NickProp28 , You can add like
KPI color Previos19_20_A =
VAR Green = "#056608"
VAR Red = "#CB0525"
VAR Result = IF([Diff % previos month_2020_A] >=0 && Max(Table[Year]) ="20202", Green, Red)
Return
Result
refer to My video : https://www.youtube.com/watch?v=RqBb5eBf_I4
other examples
Colour =
SWITCH(TRUE(),
max('Table'[Month Year]) = "Jan-2020", "red",
Max('Table'[Month Year]) < "Feb-2020", "orange",
//keep on adding
"green")
@NickProp28 , I typically use TI for this with slicer of date on current month or year
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
diff = [MTD Sales]-[last MTD Sales]
diff % = divide([MTD Sales]-[last MTD Sales],[last MTD Sales]) // Conditional formatting on this
for year
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ]) // Use in conditional formatting
Default Date : https://www.youtube.com/watch?v=hfn05preQYA
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |