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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

conditional formatting in matrix when value is in rows

The matrix has values on rows where a1,a2,a3... are different measures distributed along the

8 weeks date range. I want a conditional formatting as for the date 24-01-2022. When the value for the current week (i.e. 24-01-2022) is greater than prev week (i.e. 17-01-2022) there should be a green upward arrow and when less it should show a red downward arrow. How to get this format?
doubt.png

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

Try to add the following measure and then use the values to do the contional formatting:

Condittional format =
VAR currentWeek =
    SELECTEDVALUE ( Table[Date] )
VAR TotalWeek =
    CALCULATE ( MAX ( Table[Date] ), ALLSELECTED ( Table ) )
VAR CurrentWeekValue =
    SUM ( Table[Vaalue] )
VAR PreviousWeekValue =
    CALCULATE (
        SUM ( Table[Value] ),
        FILTER (
            ALL ( Table[Date] ),
            Table[Date]
                = MAX ( Table[Date] ) - 7
        )
    )
RETURN
    IF (
        currentWeek = TotalWeek,
        IF ( CurrentWeekValue - PreviousWeekValue < 0, -1, 1 )
    )

 

Be aware that this measure only works when the fact table only has one date for each week (weekly data) if you have daily data this needs to be modified.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @Anonymous ,

 

Try to add the following measure and then use the values to do the contional formatting:

Condittional format =
VAR currentWeek =
    SELECTEDVALUE ( Table[Date] )
VAR TotalWeek =
    CALCULATE ( MAX ( Table[Date] ), ALLSELECTED ( Table ) )
VAR CurrentWeekValue =
    SUM ( Table[Vaalue] )
VAR PreviousWeekValue =
    CALCULATE (
        SUM ( Table[Value] ),
        FILTER (
            ALL ( Table[Date] ),
            Table[Date]
                = MAX ( Table[Date] ) - 7
        )
    )
RETURN
    IF (
        currentWeek = TotalWeek,
        IF ( CurrentWeekValue - PreviousWeekValue < 0, -1, 1 )
    )

 

Be aware that this measure only works when the fact table only has one date for each week (weekly data) if you have daily data this needs to be modified.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



v-chenwuz-msft
Community Support
Community Support

Hi @Anonymous , 

 

Unfortunately, Conditional formatting of icons supports only static values for the rules. You can submit your idea on power bi ideas website.

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

MFelix
Super User
Super User

Hi @Anonymous ,

 

When you refer that you want to have the  condittional formatting should be for the current week is the maximum week selected on the 8 weeks range? 

 

Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors