Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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.
User | Count |
---|---|
20 | |
14 | |
11 | |
8 | |
6 |
User | Count |
---|---|
23 | |
23 | |
20 | |
15 | |
10 |