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
DataAnalyst7
Frequent Visitor

Conditional Formating for Table Visualization in Power Bi Desktop

I have a table Visualization with percentages in power Bi. I want to format it in such a way that I can see an increase or decrease from the previous month. I am not sure how to go about it to be honest. But when I tried, I could see anything that could help me.PleaseScreenshot (28).png

1 ACCEPTED SOLUTION
v-xinruzhu-msft
Community Support
Community Support

Hi @DataAnalyst7 

You can refer to the following solution.

Sample data 

vxinruzhumsft_0-1702524075125.png

Create three measure

 

Format_fc =
VAR _preffc =
    CALCULATE (
        SUM ( 'Table'[%Stock to FC] ),
        'Table'[Monthnumber]
            = MAX ( 'Table'[Monthnumber] ) - 1,
        ALLSELECTED ( 'Table' )
    )
RETURN
    IF (
        NOT ( ISBLANK ( _preffc ) ),
        IF ( SUM ( 'Table'[%Stock to FC] ) - _preffc > 0, 1, 0 )
    )
Format_fcr =
VAR _preffcr =
    CALCULATE (
        SUM ( 'Table'[%Stock to FCR] ),
        'Table'[Monthnumber]
            = MAX ( 'Table'[Monthnumber] ) - 1,
        ALLSELECTED ( 'Table' )
    )
RETURN
    IF (
        NOT ( ISBLANK ( _preffcr ) ),
        IF ( SUM ( 'Table'[%Stock to FCR] ) - _preffcr > 0, 1, 0 )
    )
Format_rica =
VAR _prerica =
    CALCULATE (
        SUM ( 'Table'[%Stock to RICA] ),
        'Table'[Monthnumber]
            = MAX ( 'Table'[Monthnumber] ) - 1,
        ALLSELECTED ( 'Table' )
    )
RETURN
    IF (
        NOT ( ISBLANK ( _prerica ) ),
        IF ( SUM ( 'Table'[%Stock to RICA] ) - _prerica > 0, 1, 0 )
    )

Then put them to the conditional formatting of the [%Stock to RICA],[%Stock to FC],[%Stock to FCR], select icons

vxinruzhumsft_0-1702531499462.png

 

vxinruzhumsft_1-1702531512437.png

 

vxinruzhumsft_2-1702531525951.png

 

vxinruzhumsft_3-1702531540571.png

 

Output

vxinruzhumsft_4-1702531550315.png

 

Best Regards!

Yolo Zhu

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

 

 

 

 

 

View solution in original post

2 REPLIES 2
v-xinruzhu-msft
Community Support
Community Support

Hi @DataAnalyst7 

You can refer to the following solution.

Sample data 

vxinruzhumsft_0-1702524075125.png

Create three measure

 

Format_fc =
VAR _preffc =
    CALCULATE (
        SUM ( 'Table'[%Stock to FC] ),
        'Table'[Monthnumber]
            = MAX ( 'Table'[Monthnumber] ) - 1,
        ALLSELECTED ( 'Table' )
    )
RETURN
    IF (
        NOT ( ISBLANK ( _preffc ) ),
        IF ( SUM ( 'Table'[%Stock to FC] ) - _preffc > 0, 1, 0 )
    )
Format_fcr =
VAR _preffcr =
    CALCULATE (
        SUM ( 'Table'[%Stock to FCR] ),
        'Table'[Monthnumber]
            = MAX ( 'Table'[Monthnumber] ) - 1,
        ALLSELECTED ( 'Table' )
    )
RETURN
    IF (
        NOT ( ISBLANK ( _preffcr ) ),
        IF ( SUM ( 'Table'[%Stock to FCR] ) - _preffcr > 0, 1, 0 )
    )
Format_rica =
VAR _prerica =
    CALCULATE (
        SUM ( 'Table'[%Stock to RICA] ),
        'Table'[Monthnumber]
            = MAX ( 'Table'[Monthnumber] ) - 1,
        ALLSELECTED ( 'Table' )
    )
RETURN
    IF (
        NOT ( ISBLANK ( _prerica ) ),
        IF ( SUM ( 'Table'[%Stock to RICA] ) - _prerica > 0, 1, 0 )
    )

Then put them to the conditional formatting of the [%Stock to RICA],[%Stock to FC],[%Stock to FCR], select icons

vxinruzhumsft_0-1702531499462.png

 

vxinruzhumsft_1-1702531512437.png

 

vxinruzhumsft_2-1702531525951.png

 

vxinruzhumsft_3-1702531540571.png

 

Output

vxinruzhumsft_4-1702531550315.png

 

Best Regards!

Yolo Zhu

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

 

 

 

 

 

Ritaf1983
Super User
Super User

Hi @DataAnalyst7 

Please refer to the linked discussion.

https://community.fabric.microsoft.com/t5/Desktop/Conditional-formatting-based-on-differences-betwee...

And the linked tutorial

https://radacad.com/month-over-month-calculation-in-power-bi-using-dax

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

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.