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
Anonymous
Not applicable

Measure should change the color based on the condition

Hi Team,

I have a measure which show max date from date colum, I should change its color when the date is less than today and the status is not equal to completed.

 

Thanks !

 

1 ACCEPTED SOLUTION
timg
Solution Sage
Solution Sage

Hi Raks, Here's an example of how I did it in a report.

1. create  a measure which returns 1 if the max refresh date = today, else 0. Code snippit below

RefreshDateIsToday = IF(MAX(LastReportRefresh[LastReportRefreshDate]) = TODAY(), 1, 0)

2. add conditional formatting to the datalabel in which you assign one colour when the RefreshDateIsToday measure = 1, and assign a different colour when it is 0.

example:

1.PNG

 

Hope that solves it for you as well.

 

Regards,

 

Tim

 





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

Proud to be a Super User!




View solution in original post

10 REPLIES 10
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Have you solved your problem? could you mark the answer helpful as the solution, so that the others having same question can find this post quickly. Thanks.

 

Best Regards,

Community Support Team _ Tang

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

timg
Solution Sage
Solution Sage

Hi Raks, Here's an example of how I did it in a report.

1. create  a measure which returns 1 if the max refresh date = today, else 0. Code snippit below

RefreshDateIsToday = IF(MAX(LastReportRefresh[LastReportRefreshDate]) = TODAY(), 1, 0)

2. add conditional formatting to the datalabel in which you assign one colour when the RefreshDateIsToday measure = 1, and assign a different colour when it is 0.

example:

1.PNG

 

Hope that solves it for you as well.

 

Regards,

 

Tim

 





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

Proud to be a Super User!




Anonymous
Not applicable

@timg ,

I need the value to change when my status is not equal to "Complete"

In that case instead of using the measure in which you check whether the max date is equal to today, you could create a measure where your return a 1 if the status is completed or a 0 when it has another value, and then use that measure in the conditional formatting. 

 

regards,

 

Tim





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

Proud to be a Super User!




Anonymous
Not applicable

@timg ,

I dint get you,

Please explain me in detail

Hi Raks,

 

I missed the "completed" requirement in your first message, here's an example of a measure where you take into account both criteria. So in this example you take the max date of the completed runs, and compares that to the current day 

RefreshDateIsToday = 
IF (
    CALCULATE (
        MAX ( LastReportRefresh[LastReportRefreshDate] ),
        FILTER ( LastReportRefresh, LastReportRefresh[Status] = "Completed" )
    )
        = TODAY (),
    1,
    0
)

 Regards,

 

Tim





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

Proud to be a Super User!




Anonymous
Not applicable

@timg ,

Here is my DAX and I have error.

image.png

Hi raks3,

Currently you are closing the CALCULATE() right after the end date "CALCULATE(end date)". The calculate should also include the filter statement. So if you remove the ")" after end date it should work.

 

Regards,

 

Tim

 





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

Proud to be a Super User!




Anonymous
Not applicable

@timg ,

I am not closing Calculate().

image.png

Hi Raks, In my previous reply I meant the close in the beginning, below you'll find the issue highlighted: 

timg_0-1624449250259.png

 





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

Proud to be a Super User!




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.