Forum Discussion

chutli's avatar
chutli
Frequent Visitor
5 years ago
Solved

Use parameters to create conditional columns

When I first created 3 Parameter. Service Level for A class I set up at 0.97, and B class at 0.95 and Class at 0.93.  Then I created a calculated coloumn call "Service Level" based on the parameter ...
  • selimovd's avatar
    selimovd
    5 years ago

    Hey chutli ,

     

    that was a little trick, but try the following measure. I guess you have to adapt it to your tables:

    ServiceLevel = 
    VAR vClassA = SELECTEDVALUE('Input_Service Level - A'[A Value], 1) -- Name of your Slicer table and column
    VAR vClassB = SELECTEDVALUE('Input_Service Level - B'[B Value], 1)
    VAR vClassC = SELECTEDVALUE('Input_Service Level - C'[C Value], 1)
    VAR vAverage =
        AVERAGEX(
            Data_Master,
            VAR vRowClass = Data_Master[ABC_Class_Cost]
            RETURN
                SWITCH(
                    vRowClass,
                    "A", vClassA,
                    "B", vClassB,
                    "C", vClassC
                ) * 1
        )
    RETURN
        vAverage

     

    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