Forum Discussion

Mal_Sondh's avatar
Mal_Sondh
Icon for Helper II rankHelper II
5 years ago
Solved

Maximum Flag/Value over 2 columns

Hi,

 

If i wanted to create a filter for a chart and only wanted to include the Max Versions per Month end, how can i do this - example data as follows

 

Snap KeySnap DateMonth EndVersion
12021-02-022021-01-311
22021-02-062021-01-312
32021-03-022021-02-281
42021-04-022021-03-301
52021-04-042021-03-302
62021-04-042021-03-303

 

When i apply the filter i should only see the following:

Snap KeySnap DateMonth EndVersion
22021-02-062021-01-312
32021-03-022021-02-281
62021-04-042021-03-303

 

Any help would be appreciated.

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Mal_Sondh 

    You can create a measure and then put the measure in the filter .

    max version =

    var max_version=CALCULATE(MAX('Table'[Version]),ALLEXCEPT('Table','Table'[Month End]))

    return IF(SELECTEDVALUE('Table'[Version])=max_version,1,0)

    Then put the measure in the filter ,set the value is equal to 1 ,

    The effect is as shown :

    I have attached my pbix file ,you can refer to it .

     

    Best Regards

    Community Support Team _ Ailsa Tao

     

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

3 Replies

  • Mal_Sondh , Create measure like these for snap key and version and use with Month, take max of date if needed

     

    Version =
    VAR __id = MAX ('Table'[Month ] )
    VAR __date = CALCULATE ( MAX('Table'[Date] ), ALLSELECTED ('Table' ), 'Table'[Month ] = __id )
    CALCULATE ( max ('Table'[End Version] ), VALUES ('Table'[Month] ),'Table'[Month] = __id,'Table'[Date] = __date )

     

    Snap =
    VAR __id = MAX ('Table'[Month ] )
    VAR __date = CALCULATE ( MAX('Table'[Date] ), ALLSELECTED ('Table' ), 'Table'[Month ] = __id )
    CALCULATE ( max ('Table'[Snap Key] ), VALUES ('Table'[Month] ),'Table'[Month] = __id,'Table'[Date] = __date )

    • Mal_Sondh's avatar
      Mal_Sondh
      Icon for Helper II rankHelper II

      amitchandak 

      so the name of the table is Snapshot - are you referencing any other tables above in your query?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Mal_Sondh 

    You can create a measure and then put the measure in the filter .

    max version =

    var max_version=CALCULATE(MAX('Table'[Version]),ALLEXCEPT('Table','Table'[Month End]))

    return IF(SELECTEDVALUE('Table'[Version])=max_version,1,0)

    Then put the measure in the filter ,set the value is equal to 1 ,

    The effect is as shown :

    I have attached my pbix file ,you can refer to it .

     

    Best Regards

    Community Support Team _ Ailsa Tao

     

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