Forum Discussion
Maximum Value from table
Hi everyone,
Im having difficulty displaying my maximum value from a table, i would appreciate if anyone could help me.
The error shows that " Argument "6" in function SWITCH is required"
My code:
- Anonymous4 years ago
Hi Anonymous ,
Please note that your code has an extra comma at the underscore I marked:
If you just want to apply a flag for the max and min value, you could simply use:
Column = var _max=MAX('energykwh energydata'[energydata_value]) var _min=MIN('energykwh energydata'[energydata_value]) return SWITCH(TRUE(), [energydata_value]=_max,2,[energydata_value]=_min,1)Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- smpa01Community Champion
Anonymous get rid of the last comma in SWITCH
VAR Result=SWITCH(TRUE(),CurrentVal= MinVal, 1,CurrentVaL= MaxVal,2)RETURNResult- AnonymousNot applicable
Hi, i still am unabe to extract the maximum value out from the table. Do you by any chance know how to extract the value? My code was not working. This is my table.
- smpa01Community Champion
Anonymous can you please provide some sample dat and expected output?
- AnonymousNot applicable
Hi Anonymous ,
Please note that your code has an extra comma at the underscore I marked:
If you just want to apply a flag for the max and min value, you could simply use:
Column = var _max=MAX('energykwh energydata'[energydata_value]) var _min=MIN('energykwh energydata'[energydata_value]) return SWITCH(TRUE(), [energydata_value]=_max,2,[energydata_value]=_min,1)Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.