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
Mahadevaraobc
Helper II
Helper II

Conditional formatting

Hi,

Please let me know if this is possible, i have  some data in matrix view where in the column there is month and row there are product sales

eg.

Products201711201712201801201802201803
Product A1309512689140761418714507

I have attached my dataset for reference.

What i would like to get is, if current month sales is more than 10% of previous month it should be in green.

let me know if this is can be achieved.

 

Products201711201712201801201802201803201804201805201806201807201808201809201810201811201812201901201902
Product A13095126891407614187145071405314674136891395615762139141839414616127581371714199
Product B3684343438943795416034723989364135943786317342303539281133523440
Product C2659247528892691332627413552346533213580319441963440309826442788
Product D1806198425262722300127762991277227803400256629432735269126412482
Product E2103178221442133227218262391234924362515222625372187199623522121
Product F370386448502638651779109812661377138013931276141118881964
Product G857772834906948952105810369259388429918017198601032
Product H2 10202712201101831931201521291557929
Product I1015866102910001063104695310201036901997984995863823812
Product J            39234194235
Product K798092657662729311381115103406480140
Product L            11849111
4 REPLIES 4
TeigeGao
Solution Sage
Solution Sage

Hi @Mahadevaraobc ,

Please refer to the following steps:

First, we can create a calculated column as a rank for date, please refer to the following DAX query:

timerank =
CALCULATE (
    COUNTROWS ( Table1 ),
    FILTER (
        ALL ( Table1 ),
        Table1[Products] = EARLIER ( Table1[Products] )
            && Table1[Date] < EARLIER ( Table1[Date] )
    )
) + 1

Then we can create a measure to judge if the data meets the requirement:

Measure =
VAR lastmon =
    CALCULATE (
        MIN ( Table1[Value] ),
        FILTER (
            ALL ( Table1 ),
            Table1[Products] = MIN ( Table1[Products] )
                && Table1[timerank]
                    = MIN ( Table1[timerank] ) - 1
        )
    )
VAR result =
    IF (
        lastmon = BLANK (),
        0,
        DIVIDE ( MIN ( Table1[Value] ) - lastmon, lastmon )
    )
RETURN
    IF ( result > 0.1, 1, 0 )

Then, in the format panel, we can set the Conditional Formatting like below:

Snipaste_2019-04-17_14-45-59.png

The result will like below:

Snipaste_2019-04-17_14-46-43.png

Here is the sample pbix file, please check it: https://1drv.ms/u/s!Ao9Of0JgO6MU72BV52pw-fZH9gtj

Best Regards,

Teige

Thanks for the reply TeigeGao,

 

I tried this but it is not working on my data, do i need to unpivot my data before doing this?

My data has many other columns also..

Hi @Mahadevaraobc ,

Could you please share some sample data to me for analysis? Besides, please first check my pbix file, it includes my sample data.

Best Regards,

Teige

Hi,

Here is the sample data,

 

Products201711201712201801201802201803201804201805201806201807201808201809201810201811201812201901201902
Product A13095126891407614187145071405314674136891395615762139141839414616127581371714199
Product B3684343438943795416034723989364135943786317342303539281133523440
Product C2659247528892691332627413552346533213580319441963440309826442788
Product D1806198425262722300127762991277227803400256629432735269126412482
Product E2103178221442133227218262391234924362515222625372187199623522121
Product F370386448502638651779109812661377138013931276141118881964
Product G857772834906948952105810369259388429918017198601032
Product H2 10202712201101831931201521291557929
Product I1015866102910001063104695310201036901997984995863823812
Product J            39234194235
Product K798092657662729311381115103406480140

Product

L

            11849

111

 

The above data is from a matrix visual and i would want conditional formatting to be applied to this visual only... 

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.

Top Solution Authors