March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
14 | |
11 | |
8 | |
5 |
User | Count |
---|---|
28 | |
21 | |
20 | |
13 | |
10 |