Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

display count from measure

Hello, 

 

I create measure  to return specific text from condition 

 

 

 

Performance = 
var runpercent =
    [work day]/([COUNTDAY]
    )
var totalmile = 
    SUM('Distance'[Distance]
    )
var target =
    1300*[work day]/[COUNTDAY]
return

SWITCH(
    TRUE(),
     runpercent < 0.6, "VOR",
     totalmile <= target, "LOW DISTANCE",
     runpercent >= 0.6 && totalmile > target, "ON PERFORMANCE",
    BLANK()
)

 

 

 

I put the measure into table the result as follow  but i would like to count number of each "VOR" "LOW DISTANCE" and "ON PERFORMANCE"    and display on the card    please suggest me how to do it.

 

below is my data table:

 

 

thank you.

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create measures. 

    Count_lowdistance = var a=SUMMARIZE(ALLSELECTED(Distance),[License],"Flag",[Performance])
    return COUNTROWS(FILTER(a,[License] in VALUES(Distance[License])&&[Flag]="LOW DISTANCE"))
    Count_performance = var a=SUMMARIZE(ALLSELECTED(Distance),[License],"Flag",[Performance])
    return COUNTROWS(FILTER(a,[License] in VALUES(Distance[License])&&[Flag]="ON PERFORMANCE"))
    Count_VOR = var a=SUMMARIZE(ALLSELECTED(Distance),[License],"Flag",[Performance])
    return COUNTROWS(FILTER(a,[License] in VALUES(Distance[License])&&[Flag]="VOR"))
    Sum_countper = SUMX(VALUES(Distance[License]),[Count_performance])
    Sum_lowdis = SUMX(VALUES(Distance[License]),[Count_lowdistance])
    Sum_vor = SUMX(VALUES(Distance[License]),[Count_VOR])

    (3) Then the result is as follows.

    Best Regards,

    Neeko Tang

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

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create measures. 

    Count_lowdistance = var a=SUMMARIZE(ALLSELECTED(Distance),[License],"Flag",[Performance])
    return COUNTROWS(FILTER(a,[License] in VALUES(Distance[License])&&[Flag]="LOW DISTANCE"))
    Count_performance = var a=SUMMARIZE(ALLSELECTED(Distance),[License],"Flag",[Performance])
    return COUNTROWS(FILTER(a,[License] in VALUES(Distance[License])&&[Flag]="ON PERFORMANCE"))
    Count_VOR = var a=SUMMARIZE(ALLSELECTED(Distance),[License],"Flag",[Performance])
    return COUNTROWS(FILTER(a,[License] in VALUES(Distance[License])&&[Flag]="VOR"))
    Sum_countper = SUMX(VALUES(Distance[License]),[Count_performance])
    Sum_lowdis = SUMX(VALUES(Distance[License]),[Count_lowdistance])
    Sum_vor = SUMX(VALUES(Distance[License]),[Count_VOR])

    (3) Then the result is as follows.

    Best Regards,

    Neeko Tang

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Neeko Tang,

       

       As I follow your step and the result is satisfied.   Thank you  my life saver.  😘😘🌻

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello Anonymous Neeko Tang, 

          

         May I ask another one question.  I would like to create bar chart as picture below   from a file i provided earlier.  
      Axis Y is count of truck 
      Axis X is sum of distance and divided into a group.

       

      How to made bar chart like this but the truck that take into account is only "On Performance" Truck.
      Is  it possible with data provided ?

      Thank you in advance.

       

      Best Regards 

      JJ