Forum Discussion

ravitejaballa's avatar
ravitejaballa
Icon for Helper III rankHelper III
6 years ago
Solved

Count by Catagory

Hi,

 

I trying to get number of DeviceID for a each catagory (binLegendColumn).

But it has to be for latest value for a given timestamp.

As you can see below, i am able to fetch latest hours value (<= timestamp)

 

 

From this, expected output

binLegendnumber of distinct deviceid
< 0 Hours1
0 - 24 Hours2
25 - 100 Hours1
> 100 Hours1

 

my pbix file:

https://1drv.ms/u/s!AhI1WOiXwAe-qNl6FDPyeZvIv-Xzew?e=98X6Fa

 

Here is my sample data.

DeviceIDlastValueHoursbinLegendColumntimestamp
A-345< 0 Hours7/13/2020 0:00
A-150< 0 Hours7/12/2020 0:00
A00 - 24 Hours7/11/2020 0:00
A200 - 24 Hours7/10/2020 0:00
A5025 - 100 Hours7/9/2020 0:00
A200> 100 Hours7/8/2020 0:00
B10025 - 100 Hours7/12/2020 0:00
B7025 - 100 Hours7/11/2020 0:00
B240 - 24 Hours7/10/2020 0:00
B00 - 24 Hours7/9/2020 0:00
B-300< 0 Hours7/8/2020 0:00
C230 - 24 Hours7/13/2020 0:00
C00 - 24 Hours7/12/2020 0:00
C00 - 24 Hours7/11/2020 0:00
C-100< 0 Hours7/10/2020 0:00
C-250< 0 Hours7/9/2020 0:00
D200> 100 Hours7/12/2020 0:00
D10025 - 100 Hours7/11/2020 0:00
D200 - 24 Hours7/10/2020 0:00
D-5< 0 Hours7/9/2020 0:00
D-150< 0 Hours7/8/2020 0:00
E220 - 24 Hours7/12/2020 0:00
E50 - 24 Hours7/11/2020 0:00
E20 - 24 Hours7/10/2020 0:00
E-15< 0 Hours7/9/2020 0:00
E-25< 0 Hours7/8/2020 0:00

 

binbinLegend
1< 0 Hours
20 - 24 Hours
325 - 100 Hours
4> 100 Hours

 

 

  • Ashish_Mathur's avatar
    Ashish_Mathur
    6 years ago

    Hi,

    You may download my PBI file from here.  i have solve it using measures only.

    Hope this helps.

18 Replies

  • ravitejaballa , You can try measures like

     

    m1 =lastnonblankvalue(Table[timestamp],max(Table[binLegendColumn]))

     

    m2 = lastnonblankvalue(Table[timestamp],max(Table[lastValueHours]))

    • ravitejaballa's avatar
      ravitejaballa
      Icon for Helper III rankHelper III

      amitchandak 

      Thanks for reply,

      I already have these measure in my report.

       

       

       

       

       

       

       

       

      Using this measure, i want to get count of number of deviceID for each legend.

      Like below.

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi ravitejaballa ,

         

        Based on your Data No of Distinct Device Id are as below.

         

         

         

         

        In such case you can just use.

         

        (DISTINCTCOUNT(deviceHours[DeviceID])

         

         

         

        How did you get 1 , 2, 1, 1 .

         

        Let me know if I am missing something.

         

        Regards

        Harsh Nathani

        Appreciate with a Kudos!! (Click the Thumbs Up Button)

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

         

         

  • v-diye-msft's avatar
    v-diye-msft
    Icon for Community Support rankCommunity Support

    Hi ravitejaballa 

     

    If you've fixed the issue on your own please kindly share your solution. if the above posts help, please kindly mark it as a solution to help others find it more quickly. If not, please kindly elaborate more. thanks!