The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi everyone,
I created two parameters with lists of measures, two slicers and one matrix with these parameters.
My question is, Is it possible to create a measure to calculate the difference between two measures selected in slicer parameters?
I created this measures and don't bring me error messages
Solved! Go to Solution.
Hi @mscla ,
I created some data:
If you want to add a row to a matrix Row, you need to create a new table column as a Row, and then create a measure that uses the switch() function to determine the value corresponding to each value.
Here are the steps you can follow:
1. Enter data – create a table.
According to the Power BI design, the default sorting is alphabetical, so we need an Index to customize the sorting.
[Group] – Column tools – Sort by column – [lndex]
2. Create measure.
Test =
SWITCH(
TRUE(),
MAX('Row_Group'[Group])="MEASURE1",[Parameter_Measures],
MAX('Row_Group'[Group])="MEASURE2",[Parameter_Measures2],
MAX('Row_Group'[Group])="DIFFERENCE",[Parameter_Measures] - [Parameter_Measures2])
3. Result:
If it doesn't meet your desired outcome, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi my friend,
I really liked your idea, but I got a simpler solution.
The measurements are then based on a single table that isn't that big, so I made a copy of the table and created similar versions of the measurements,
like this
table 1 and measurements: 1, 2, 3
table 1a and measurements: 1a, 2a, 3a
So I created the parameters for measurements.
but thanks for all
Hi @mscla ,
I created some data:
If you want to add a row to a matrix Row, you need to create a new table column as a Row, and then create a measure that uses the switch() function to determine the value corresponding to each value.
Here are the steps you can follow:
1. Enter data – create a table.
According to the Power BI design, the default sorting is alphabetical, so we need an Index to customize the sorting.
[Group] – Column tools – Sort by column – [lndex]
2. Create measure.
Test =
SWITCH(
TRUE(),
MAX('Row_Group'[Group])="MEASURE1",[Parameter_Measures],
MAX('Row_Group'[Group])="MEASURE2",[Parameter_Measures2],
MAX('Row_Group'[Group])="DIFFERENCE",[Parameter_Measures] - [Parameter_Measures2])
3. Result:
If it doesn't meet your desired outcome, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi my friend,
I really liked your idea, but I got a simpler solution.
The measurements are then based on a single table that isn't that big, so I made a copy of the table and created similar versions of the measurements,
like this
table 1 and measurements: 1, 2, 3
table 1a and measurements: 1a, 2a, 3a
So I created the parameters for measurements.
but thanks for all
Hi Greg, thanks for replay
I really don't need CALCULATE, you are right!
So, my goal is to create a row in the matrix that shows the difference between measures (single selection forced)
Is there an easy way to do that?
@mscla Well, for starters, there is no need for CALCULATE in your expression. The error seems to be referring to some other measure or something. The error is probably very dependent on the context of your visual.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
18 | |
18 | |
17 | |
15 | |
13 |
User | Count |
---|---|
36 | |
34 | |
19 | |
18 | |
17 |