Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

latest value text

I am trying to create the below table;   i have the following data;   IdUsernameProduct IDProduct LevelDate 1 John 1 High 06 February 2020 2 John 1 Low 07 February 2020 3 J...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous ,

    You can create two measures as below, then create a bar chart with Product Level field on Axis fields and new measure “CountofPlevel" on Values field:

    NProduct Level =
    VAR _maxdate =
        CALCULATE (
            MAX ( 'Table'[Date] ),
            FILTER ( ALL ( 'Table' ), 'Table'[Product ID] = MAX ( 'Table'[Product ID] ) )
        )
    RETURN
        CALCULATE (
            MAX ( 'Table'[Product Level] ),
            FILTER (
                ALL ( 'Table' ),
                'Table'[Product ID] = MAX ( 'Table'[Product ID] )
                    && 'Table'[Date] = _maxdate
            )
        )
    CountofPlevel =
    VAR _tab =
        SUMMARIZE ( 'Table', 'Table'[Product ID], "Npl", [NProduct Level] )
    RETURN
        COUNTROWS ( FILTER ( _tab, [Npl] = MAX ( 'Table'[Product Level] ) ) )

    Best Regards

    Rena