Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

SUM VALUES FOR THE PREVIOUS ROUND

Hello...

I have table employee

which have 

IDVALUEROUND
1101
2101
3101
4202
5302
6203
7203
8203

and round table which have 

ROUND
1
2
3

 

how to write dax eqaution to sum values for previous round

eg. output

ROUNDsumprev sum
130 
25030
36050

 

3 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi Anonymous 

    Measure =
    CALCULATE (
        SUM ( Table1[VALUE] ),
        FILTER (
            ALL ( Table1[Round] ),
            Table1[Round] = ( SELECTEDVALUE ( Table1[Round] ) - 1 )
        )
    )

     

    Please mark the question solved when done and consider giving kudos if posts are helpful.

    Cheers  Datanaut

       

    • Anonymous's avatar
      Anonymous
      Not applicable

      thank you for responding...

      but ssas doesn't support the function 

      SELECTEDVALUE 

      is there any work around ?

      • AlB's avatar
        AlB
        Community Champion
        Measure =
        CALCULATE (
            SUM ( Table1[VALUE] ),
            FILTER (
                ALL ( Table1[Round] ),
                Table1[Round] = IF ( HASONEVALUE ( Table1[Round] ), VALUES ( Table1[Round] ) - 1 )
            )
        )
        

         

        Please mark the question solved when done and consider giving kudos if posts are helpful.

        Cheers  Datanaut