The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a model where I have 1 calculation group for time intelligence. I am using it in a matrix so users can select what time intelligence options they see via a slicer for the calculation group. I want to apply conditional formatting to the growth measures to highlight green for positive growth, red for negative growth. I've found several articles about using the measure:
CFMeasure = IF ( SELECTEDVALUE( 'calcgrouptable'[calcgroup]) IN {"PM∆"},
[measure],
BLANK()
)
then using this in the conditional formatting for the table.
What is happening is, instead of the calculated item being shown in the result, the actual (uncalculated) value is shown so the conditional formatting isn't in the right context. When I add the conditional formatting measure to the table you can see the result is not as expected:
I suspect this may have something to do with precedence but I dont have any other calculation groups and I tried different precedence values to see if it would help, but nothing.
Solved! Go to Solution.
I think I've figured out why this was not working but I dont fully understand the why.
The calculation items I am trying to apply the formatting to are difference calculations so for example TY-PY. In the calculation I was using the format:
SELECTEDMEASURE()-
CALCULATE(
SELECTEDMEASURE(),
'calcgroup'[calcitem] = "PM"
)
I noticed that when I changed to the process in the video shared by @parry2k (thanks) that the measures which didnt reference other calculation items were working correctly. So I changed the second part of the above formula to just do the calculation for PM and not reference the other calculation item and...
IT WORKS!
Like I said, I dont really understand why it works this way and not the other, but whatever works. Now to change all my calculations items!
I think I've figured out why this was not working but I dont fully understand the why.
The calculation items I am trying to apply the formatting to are difference calculations so for example TY-PY. In the calculation I was using the format:
SELECTEDMEASURE()-
CALCULATE(
SELECTEDMEASURE(),
'calcgroup'[calcitem] = "PM"
)
I noticed that when I changed to the process in the video shared by @parry2k (thanks) that the measures which didnt reference other calculation items were working correctly. So I changed the second part of the above formula to just do the calculation for PM and not reference the other calculation item and...
IT WORKS!
Like I said, I dont really understand why it works this way and not the other, but whatever works. Now to change all my calculations items!
@dange187 check this video if it helps Why simple conditional formatting is not simple anymore with Calculation Groups - Power BI - YouTube
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
User | Count |
---|---|
78 | |
74 | |
43 | |
32 | |
28 |
User | Count |
---|---|
104 | |
95 | |
51 | |
50 | |
46 |