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

Show last value in Cards

Hi, 

 

I have difficulties with the card visualisation. I have a datasets which only contains binary values 0 and 1 for a certain period. I have converted these values in 0 --> error and 1--> OK! by making a new column with:

 

Status = IF(health[Code]=1;"Error";"OK!")

 

Next I tried to put this in a card and I wanted it to show only the last status. So for example,

 

5-6-2017 = Error

8-9-2017 = Error

31-12-201 = OK!

 

The status should thus be OK! However, I noticed the card only shows maximum or minimum value during that period and not the last value of that period. In the example, the card would only show Error; the maximum value of during the whole period.

I have tried to set the field in "last" or "first", but both did not work for me.

 

Could anyone help me?

1 ACCEPTED SOLUTION

Hi @KIMPD,

 

You can create a measure below, then put this measure in a card visual. For details, you can download attached pbix file. 

 

Measure = var maxP=CALCULATE(MAX('Table1'[Period]),ALLSELECTED(Table1))
return
CALCULATE(MAX('Table1'[Status]),FILTER('Table1','Table1'[Period]=maxP))

 

w5.PNG

 

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
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

6 REPLIES 6
v-qiuyu-msft
Community Support
Community Support

Hi @KIMPD,

 

Assume the data below: 

 

q5.PNG

 

In Power BI desktop version 2.51.4885.701 64-bit (October 2017), after place the Status calculated column to the card visual and set Last aggregation, it displays OK. You can see attached pbix file. 

 

q6.PNG

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Dear @v-qiuyu-msft,

 

I have already tried that (I also mentioned this in the opening post:

"The status should thus be OK! However, I noticed the card only shows maximum or minimum value during that period and not the last value of that period. In the example, the card would only show Error; the maximum value of during the whole period.

I have tried to set the field in "last" or "first", but both did not work for me.")

 

Indeed this will cause the card to change in OK!, however, when you add for example a slicer and you change the period, the value will be the highest or the lowest value: see attachement. 

test.png

 

 

Hi @KIMPD,

 

You can create a measure below, then put this measure in a card visual. For details, you can download attached pbix file. 

 

Measure = var maxP=CALCULATE(MAX('Table1'[Period]),ALLSELECTED(Table1))
return
CALCULATE(MAX('Table1'[Status]),FILTER('Table1','Table1'[Period]=maxP))

 

w5.PNG

 

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you! This really helped Smiley Very Happy

Omega
Impactful Individual
Impactful Individual

Shouldn't Status = IF(health[Code]=1;"OK!";"Error") ?

KIMPD
Frequent Visitor

No, that is just the matter of definition of my system.

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.