Forum Discussion

anin's avatar
anin
Frequent Visitor
5 years ago

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:

 

 

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

  • 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]))))

    • anin's avatar
      anin
      Frequent Visitor

      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

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hianin,

         

        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.