Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
chutli
Frequent Visitor

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 user input. (Pic 1 & 2)

But the Parameter is not working. As you can see in Pic 3, i change the parameter on the slicer, but in Pic 2 the value still stay the same... 

 

Where did i do wrong? Help please!

 

Capture.PNGorking. 3.PNG2.PNG

1 ACCEPTED SOLUTION

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
 

 

View solution in original post

5 REPLIES 5
selimovd
Super User
Super User

Hey @chutli ,

 

a calculated column is always static. After the file is loaded the values are not gonna change anymore.

So you have to solve that with a measure.

 

If you help me to understand a little better how the result should look like I can also help you.

 

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
 

Hello @selimovd , Colomn C is what I am trying to do. Does it make sense? Thank you

 

4.PNG

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
 

 

@selimovd Thank you for the effort, much appriciated it. unfortunately.. i think i need that to be a calculated column. 

Because the Service level column also is used for other calcuations like Safety stock level.. and it's setting on each item level instead of any aggregated group level. 


can you help me to brainstrome a bit if theres any work around? 

 

Thank you. 

 

 

chutli
Frequent Visitor

@selimovd 

oh never mind. i will just do measurea to all of them... that should works.. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.