Forum Discussion
Use parameters to create conditional columns
- 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 vAverageIf 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 regardsDenisBlog: WhatTheFact.biFollow me: twitter.com/DenSelimovic
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.
- selimovd5 years agoMost Valuable Professional
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 vAverageIf 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 regardsDenisBlog: WhatTheFact.biFollow me: twitter.com/DenSelimovic- chutli5 years agoFrequent Visitor
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.