Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
roshak
Frequent Visitor

How to model "current month" so conditional formats are ignored in future months of Matrix Visual

I am generating a matrix/table showing monthly actuals compared to two financial forecasts.  I need to conditionally format the backround color in scenarios where the ACTUALS are off by +/- 100.  I have a few dimension tables and 3 fact tables.
 
roshak_0-1677166958788.png

 

Within my FactActuals table, I created a simple measure to calculate the difference between the actuals and forecast1:
 DiffToFC1 = SUM(FactForecast1[Amount])-sum(FactActuals[Amount])
The conditional background rules are:
roshak_0-1677169392049.png

 

This works except the formatting pushes out into the future for months that have not occurred... for which I would never have actuals. I am uncertain how and where to indicate "current month" so conditional formatting can be applied correctly.  It can be pulled or inferred from my source data but I don't know how to leverage it.

roshak_1-1677167141358.png
 

Main Question: How to model "current month" and reference it in conditional background calculations for matrix visualization values so future months are ignored?  Null/Blank values in past should be considered zero for the purpose of styling... while null/bank values in future are ignored.
 

Secondary questions due to me being new to PowerBI:
  1. Is my model appropriately structured to support this visualization?  I had considered building a single massive fact table.
  2. Is a matrix the best visualization in this scenarion or should I model a flat table?  I do not need row grouping, only columns group by month/forecast/actual
  3. How do I prevent the year slicer from exceeding the number years found in the fact tables? The fact and DimBudget tables have years 2022-2023, but the DimDate table has 2024 and is shown in slicer)
  4. Is there a better mechanism to "show zeros" instead of blanks?  I have seen recommendations to create measures that add 0 but that results in additional rows shown in the matrix... (i.e., all previous budget years rather than the currently filtered)  
3 REPLIES 3
amitchandak
Super User
Super User

@roshak , you can create a color measure and use that in conditional formatting using field value option

 

example

DiffToFC1 = Switch(True() ,
eomonth(max(Date[Date]),0) = eomonth(today(),0) && SUM(FactForecast1[Amount])-sum(FactActuals[Amount])<0 , "red",
eomonth(max(Date[Date]),0) = eomonth(today(),0) && SUM(FactForecast1[Amount])-sum(FactActuals[Amount]) >0 , "Blue",
"Pink")

 

How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/...
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pan...

That approach works if I am able to use TODAY() as the comparator.  However, my "current month" is a static value that exists in my data.  Do you have a recommendation on how to store/reference that value?

That looks promising and I'll give it a try.  However, my "current month" is a value from my data , not the actual date.  I am struggling with how and where to store that info.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.