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

Measure count of the latest value

I have the following data i am sending using the api, so I can not create new columns only measures

user_idStateupdated_at
1OFF05/30/18 03:27:32 PM
2ON05/30/18 03:28:32 PM
1ON05/30/18 03:30:32 PM
2OFF05/30218 03:34:3PM
3ON05/30218 04:34:3PM

 

I would like to display a visual "CARD" with the count of all ON's, so I need to take the latest state for the User ID

 

ON = 2

  

OFF = 1

 

Please help

1 ACCEPTED SOLUTION
alexei7
Continued Contributor
Continued Contributor

Hi,

 

The following works for me, can you give it a go and see if it's giving you the correct results:

 

Measure = CALCULATE(COUNTROWS(FILTER(Table1, Table1[updated_at]=CALCULATE(max(Table1[updated_at]),ALLEXCEPT(Table1,Table1[user_id])))),Table1[State]="ON") 

 

Thanks

Alex 

View solution in original post

2 REPLIES 2
alexei7
Continued Contributor
Continued Contributor

Hi,

 

The following works for me, can you give it a go and see if it's giving you the correct results:

 

Measure = CALCULATE(COUNTROWS(FILTER(Table1, Table1[updated_at]=CALCULATE(max(Table1[updated_at]),ALLEXCEPT(Table1,Table1[user_id])))),Table1[State]="ON") 

 

Thanks

Alex 

Thank you very much for your reply this is working well, I had tried similar queries but could not get it to work.

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.