Forum Discussion
Create dynamic measure based on selection in slicer
Hi everyone,
I need to compare the values between my different "versions". I get a new version each month (P03, P04_2023, etc). I want to create dynamic measures that calculates the total value based on the version selected in slicesr and then a measure that extract the 2 versions selected from eachother. The measure needs to be dynamic so i shall not change anything in my measure each time I add a new version to my dataset and table.
I have below dataset:
Following table
Anyone have a solution for this?
Hi Anonymous
Thanks for reaching out to us.
You can try this,
(1) create the slicer table
(2) create the measure below,
compare = var _value1= CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Type]=MIN('Table'[Type]) && 'Table'[Version]=[selectedvalue1])) var _value2= CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Type]=MIN('Table'[Type]) && 'Table'[Version]=[selectedvalue2])) return IF(_value1<>BLANK()&&_value2<>BLANK(), [selectedvalue1]&"="&_value1&" vs "&[selectedvalue2]&"="&_value2,"")Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- v-xiaotang
Community Support
Hi Anonymous
Thanks for reaching out to us.
You can try this,
(1) create the slicer table
(2) create the measure below,
compare = var _value1= CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Type]=MIN('Table'[Type]) && 'Table'[Version]=[selectedvalue1])) var _value2= CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Type]=MIN('Table'[Type]) && 'Table'[Version]=[selectedvalue2])) return IF(_value1<>BLANK()&&_value2<>BLANK(), [selectedvalue1]&"="&_value1&" vs "&[selectedvalue2]&"="&_value2,"")Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.