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

Count specific values based on latest date

Hello,

 

I would like to count data entries with a specific value based on latest selected less than or equal date and have created a date table with a separate slider in my report.

 

This is my data set:

 

Count.PNG

 

In my report I would like a card visualisation to count the number of different ID's with value1 and value 2 being equal to the number "2", that are closest less than or equal to the selected date.

 

For instance if the selected day is 2. january the count would be 1. If the selected day s 6. January the count would be 2 and if the selected day is 10. january the count would be 3

 

Can someone help me how to acomplish this?

 

Thanks in advance

3 REPLIES 3
amitchandak
Super User
Super User

@anin ,

Try a measure like. I have not tested this

 

measure =
Var _1 = calculateTable(all(Table), Table[Date] <=selectedvalue(Table[Date]))
return
counrows(distinct(union(all(_1[value1]), all(_1[value2]))))

@amitchandak Thank you, but I am having trouble getting your measure to work - For the record I am not interested in counting rows where value1 and value2 are identical, but where they have the exact value 2

 

Here is my pbix file

https://easyupload.io/x2zf0m

Hi@anin,

 

The sample you provided cannot be opened, please share it again, sorry for the inconvenience.

 

Best Regards,
Caitlyn Yan

 

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

 

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.