Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to visualize most recent known value (measure)

Hi, 

 

background:

I have a dataset that tracks school performance based on attendance that categorizes the schools into low, medium, or high performing. 

 

The dataset looks like this:

 

School_IDDatePerformancescore
1013June 20200.5Medium
1013July 20200.75Medium
1013August 20201high
1122June 202000
1122July 20200.7Medium
1122August 20200.9high
1135June 20200.6Medium
1135July 20200.6Medium
1135August 20200.70

 

I have a measure that returns the most recent known score of the schools:

 

 

 

Recent_Score = 

VAR LatestDate = 
max(attendance[Date])
VAR LatestValue =
         MAXX(
            FILTER(
                attendance,
                attendance[Date] = LatestDate
            ),
            attendance[score]
        )
Return
    LatestValue

 

 

 

This works great when used across a date slicer so that we can always determine the most recent performance of that school based on the date (over time):

 

 

However, the issue I've run into and cannot seem to solve is that I would like to know: How many schools are performing in each category given the most recent known performance in that date period. I essentially want a stacked bar graph like below but instead of medium: 6, high:2, and 0: 1 it would show high: 2, Medium 1 based on the recent score in the matrix to the left.

 

I've attached a sample .pbix file here.

 

Help?

 

Thanks in advance.

 

 

 

 
 

 

 

  • Anonymous, try this measure:

     

    Recent Score =
    VAR vMaxDate =
        LASTDATE ( ALLSELECTED ( attendance[Date] ) )
    VAR vResult =
        CALCULATE ( COUNT ( attendance[score] ), vMaxDate )
    RETURN
        vResult

     

6 Replies

  • Anonymous, try this calculated column in the Values field well of the column chart:

     

    Recent Score = 
    VAR vSchool = attendance[School_ID]
    VAR vSchoolTable =
        FILTER ( attendance, attendance[School_ID] = vSchool )
    VAR vMaxDate =
        MAXX ( vSchoolTable, attendance[Date] )
    VAR vTargetRow =
        FILTER ( vSchoolTable, attendance[Date] = vMaxDate )
    VAR vResult =
        MAXX ( vTargetRow, attendance[score] )
    RETURN
        IF ( attendance[Date] = vMaxDate, vResult, BLANK () )

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      HI DataInsights ,

       

      Thanks for your work on this. I tested it and it works in returning the most recent score in the whole dataset. However, when I move the date slicer to anytime before the max date it returns blank. I would like for it to return the score for the max date defined by the date slicer. The example should return a column chart with 3 for medium since those are the scores in that date range. 

       

      Thanks in advance for helping me.

       

      • DataInsights's avatar
        DataInsights
        Icon for Super User rankSuper User

        Anonymous, try this measure:

         

        Recent Score =
        VAR vMaxDate =
            LASTDATE ( ALLSELECTED ( attendance[Date] ) )
        VAR vResult =
            CALCULATE ( COUNT ( attendance[score] ), vMaxDate )
        RETURN
            vResult

         

  • Hi,

    I'd like to help.  While you already have a Score column in your dataset, could you let me know the logic of assigning scores based on the performance?  Is it that 0.76 and above is high?  PLease clearly share the lower and upper value performance figure of each score.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Ashish_Mathur ,

       

      Thank you for your help.

       

      The scores is supposed is based on a range:

       

      "0" = "0",

      <.5 = "low".

      <.79 = "medium",

      <= 1 = "High"

       

      Thanks,