cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
silver3895 Regular Visitor
Regular Visitor

Need help modifying DAX formula for conditional formatting

Hello,

I am using the following formula to get the following result.

However, I need this logic:

 

If the value of "name" at index 2 is different from the value of "name"at index 1, then change color of "name" at index 2,
If the value of "name" at index 3 is different from the value of "name"at index 2, then change color of "name" at index 3,
If the value of "name" at index 4 is different from the value of "name"at index 3, then change color of "name" at index 4.

 

image.png

 

So if "def" is different from "abc" above it, highlight it. But don't highlight the "def" that come after it since they are not different from the value above them. I hope that makes sense.

Pls help me modify/simplify the formula to achieve that.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
ChandeepChhabra Established Member
Established Member

Re: Need help modifying DAX formula for conditional formatting

@silver3895 

  1. Please add a column for a serial number starting with 1 in your data. That can be done using Power Query >> Add Column Tab >> Index >> from 1
  2. Then write the following measure

 

Measure = 
SUMX(
    Data,
    (COUNTROWS(
        FILTER(
            ALL(Data),
            Data[Name]=EARLIER(Data[Name])&&
            Data[Sno]<=MAX(Data[Sno])
            )
        )=1
    )*1
)

Now use conditional formatting to highlight the font based on the measure.

Here is how the result looks like

Capture.PNG

I am hoping this is what you are expecting. You can download the Power BI file here

 

thanks

 

View solution in original post

1 REPLY 1
Highlighted
ChandeepChhabra Established Member
Established Member

Re: Need help modifying DAX formula for conditional formatting

@silver3895 

  1. Please add a column for a serial number starting with 1 in your data. That can be done using Power Query >> Add Column Tab >> Index >> from 1
  2. Then write the following measure

 

Measure = 
SUMX(
    Data,
    (COUNTROWS(
        FILTER(
            ALL(Data),
            Data[Name]=EARLIER(Data[Name])&&
            Data[Sno]<=MAX(Data[Sno])
            )
        )=1
    )*1
)

Now use conditional formatting to highlight the font based on the measure.

Here is how the result looks like

Capture.PNG

I am hoping this is what you are expecting. You can download the Power BI file here

 

thanks

 

View solution in original post

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors