Forum Discussion
Use a measure in a segment (variations)
Hello,
I have a matrix where I analyse my sales by client with variations between two years. The variations is a measure I created with the functions "SAMEPERIODLASTYEAR". I have as many lines as client. I want to have a segment that make users choose if they want to analyse positive variations or negative variations of sales.
How to make it work?
Thank you, I don't know if it's very simple or complicated.
You can create a disconnected table with the segments
And create a dynamic measure like :
* Delta tested is just a delta between 2 measures like in your scenario.
Delta to show =SWITCH(SELECTEDVALUE('Positive/Negative'[Segments]),"positive" ,CALCULATE([delta test],filter('Customers',[delta test]>0)),SWITCH(SELECTEDVALUE('Positive/Negative'[Segments]),"negative" ,CALCULATE([delta test],FILTER('Customers',[delta test]<0)),[delta test]))Now you can use segments from the created table as a slicer.And the new measure in the matrix +filter the matrix by this measure that should be "not blank".The pbix is attached.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
1 Reply
- Ritaf1983Super User
You can create a disconnected table with the segments
And create a dynamic measure like :
* Delta tested is just a delta between 2 measures like in your scenario.
Delta to show =SWITCH(SELECTEDVALUE('Positive/Negative'[Segments]),"positive" ,CALCULATE([delta test],filter('Customers',[delta test]>0)),SWITCH(SELECTEDVALUE('Positive/Negative'[Segments]),"negative" ,CALCULATE([delta test],FILTER('Customers',[delta test]<0)),[delta test]))Now you can use segments from the created table as a slicer.And the new measure in the matrix +filter the matrix by this measure that should be "not blank".The pbix is attached.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.