Forum Discussion

tuncay's avatar
tuncay
Helper III
4 years ago
Solved

Measure for each row

I want to create a measure, which is calculating something based on the row, which is shown on the table. So for "Gatecheck 1" I need another calculation than for "Gatecheck 2" for example. How can I differentiate?

Can I use any switch or if statement? And how?

 

  • Hey tuncay ,

     

    there is a switch statement that you could use.

    Try it like this:

    SwithcMeasure =
    SWITCH(
        TRUE(),
        MAX( 'MyTable'[Gatecheck] ) = 1, [Measure1],
        MAX( 'MyTable'[Gatecheck] ) = 2, [Measure2],
        MAX( 'MyTable'[Gatecheck] ) = 3, [Measure3]
    )

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     

4 Replies

  • selimovd's avatar
    selimovd
    Most Valuable Professional

    Hey tuncay ,

     

    there is a switch statement that you could use.

    Try it like this:

    SwithcMeasure =
    SWITCH(
        TRUE(),
        MAX( 'MyTable'[Gatecheck] ) = 1, [Measure1],
        MAX( 'MyTable'[Gatecheck] ) = 2, [Measure2],
        MAX( 'MyTable'[Gatecheck] ) = 3, [Measure3]
    )

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     
    • tuncay's avatar
      tuncay
      Helper III

      Can't use different measures for each column, since they have to be named differently

      • selimovd's avatar
        selimovd
        Most Valuable Professional

        Hey tuncay ,

         

        sorry, then I didn't understand what exactly you mean.

        Can you explain the desired result a little more detailed?

         

        Best regards

        Denis

         

  • V-lianl-msft's avatar
    V-lianl-msft
    Community Support

    The idea provided by selimovd  is correct. This formula displays specific calculation results for different values of Gatecheck . Sorry, I don't know what you expected