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.
I want to return sum of value if category = Costs and average if Category = Contract Price. Below is what I have tried but no luck.
My Columns are Category and Value.
Total =
SWITCH(SELECTEDVALUE('P&L Baseline'[Category],"Contract Price ($/Ton)", AVERAGEX(FILTER('P&L Baseline','P&L Baseline'[Category] = "Contract Price ($/Ton)"),'P&L Baseline'[Value]),"Costs($)",SUMX(FILTER('P&L Baseline','P&L Baseline'[Category] = "Costs($)"), 'P&L Baseline'[Value]))
Solved! Go to Solution.
hi @CJ0323
try like:
Total =
SWITCH(
SELECTEDVALUE('P&L Baseline'[Category]),
"Contract Price ($/Ton)", AVERAGEX(FILTER(ALL('P&L Baseline'),'P&L Baseline'[Category] = "Contract Price ($/Ton)"),'P&L Baseline'[Value]),
"Costs($)",
SUMX(FILTER(ALL('P&L Baseline'),'P&L Baseline'[Category] = "Costs($)"), 'P&L Baseline'[Value])
)
hi @CJ0323
try like:
hi @CJ0323
try like:
Total =
SWITCH(
SELECTEDVALUE('P&L Baseline'[Category]),
"Contract Price ($/Ton)", AVERAGEX(FILTER(ALL('P&L Baseline'),'P&L Baseline'[Category] = "Contract Price ($/Ton)"),'P&L Baseline'[Value]),
"Costs($)",
SUMX(FILTER(ALL('P&L Baseline'),'P&L Baseline'[Category] = "Costs($)"), 'P&L Baseline'[Value])
)
This appears to work well! Could I scale this to N number of categories?
No luck!
Error is "Too many arguments were passed to the selectedvalue() function. The maximum argument count for the function is 2."
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
97 | |
94 | |
74 | |
71 | |
64 |
User | Count |
---|---|
143 | |
109 | |
103 | |
82 | |
74 |