Forum Discussion

TFTF_BI's avatar
TFTF_BI
Icon for Helper I rankHelper I
4 years ago
Solved

Categorising into groups using a result from a calculated measure to use in a visual.

Hi Guys, Im stuck on the below. 

 

So I have a measure which gives me a total average percentage of increase or decrease.

Example:

 

(Im comparing students attendance against 2 time frames. 'this part works fine' )

 

Time frame 1 = 70% average over 20 students 

Time frame 2 = 90% average over the same 20 students

giving me an average increase of 28.5% 

 

My measure called (attandance_variance) gives my 28.5% when comparing the dynamic time frames selected.

 

I also have now got a working measure that tells me how many students within this measure have improved. shown below: 

 

Count_Students_Attendance_Improved =

VAR Count_Improved = COUNTX(
FILTER(
VALUES(Students[school_student_id]),
'Measures'[Difference_Attendance_Percentage]>0),
Students[school_student_id])

Return Count_Improved
 
This is working great and tells me that 7/20 students have improved.
 
What I am struggling with is if I want to see this result in a visual like a pie chart in catorgories for example: 
 
7/20 Improved (>0.05)
3/20 Did not significantly change (>-0.05 & <0.05)
10/20 Did not improve (<-0.05)
 
I deally I would like to drop a measure into a visual and it will break it down into the 3 catorgories for me. 
 
I would love some help in solving this problem.
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  TFTF_BI ,

    Here are the steps you can follow:

    1. Create calculated column.

    Flag =
    SWITCH(
        TRUE(),
        'Table'[Count_Students_Attendance_Improved]=0.15,"Did not significantly change (>-0.05 & <0.05)",
       'Table'[Count_Students_Attendance_Improved]=0.5,"Did not improve (<-0.05)",
        'Table'[Count_Students_Attendance_Improved]=0.35,"Improved (>0.05)")

    2. Create measure.

    Improved =
    COUNTX(FILTER( 'Table','Table'[Flag]="Improved (>0.05)"),[Flag])
    Did not improve =
    COUNTX(FILTER( 'Table','Table'[Flag]="Did not improve (<-0.05)"),[Flag])
    Did not significantly change =
    COUNTX(FILTER( 'Table','Table'[Flag]="Did not significantly change (>-0.05 & <0.05)"),[Flag])

    3. Result:

     

    Best Regards,

    Liu Yang

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

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  TFTF_BI ,

    Here are the steps you can follow:

    1. Create calculated column.

    Flag =
    SWITCH(
        TRUE(),
        'Table'[Count_Students_Attendance_Improved]=0.15,"Did not significantly change (>-0.05 & <0.05)",
       'Table'[Count_Students_Attendance_Improved]=0.5,"Did not improve (<-0.05)",
        'Table'[Count_Students_Attendance_Improved]=0.35,"Improved (>0.05)")

    2. Create measure.

    Improved =
    COUNTX(FILTER( 'Table','Table'[Flag]="Improved (>0.05)"),[Flag])
    Did not improve =
    COUNTX(FILTER( 'Table','Table'[Flag]="Did not improve (<-0.05)"),[Flag])
    Did not significantly change =
    COUNTX(FILTER( 'Table','Table'[Flag]="Did not significantly change (>-0.05 & <0.05)"),[Flag])

    3. Result:

     

    Best Regards,

    Liu Yang

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