Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello Guys,
I would like to know I can calculate the difference of the values of two selected coloumns:
The raw data is looking like that:
Time | Pressure 1 | Pressure 2 | Pressure 3 | Pressure 4 |
1 | 3 | 4 | 435 | 3 |
2 | 6 | 4 | 34 | 43 |
3 | 7 | 54 | 87 | 43 |
4 | 454 | 54 | 87 | 34 |
5 | 45 | 45 | 5 | 4 |
6 | 54 | 4 | 2 | 2 |
I would like to use a filter which is showing the data of two selected coloumns from the table and calculating the difference.
At the end, all the selected coloumns, and the calculated differences should be shown on a line chart.
For example:
1) I am selecting with my slicer the coloumns Pressure 2 and Pressure 4.
2) PowerBI is calculating the difference of Pressure 2 and pressure 4.
3) In the line Chart the curve of Pressure 2 and Pressure 4 and Pressure(4-2) is shown.
It is important to have the dynamic function. So based on the selection of the user, the difference should be calculated based on the two selected values.
Hopefully it is understandable and you can help me.
Thank you very much!
Hi, @ZoheilSharifi
You can try the following methods.
In the Power Query, choose first column-Unpivot Other Columns:
Measure1 = CALCULATE(SUM('Table'[Value]),FILTER(ALLEXCEPT('Table','Table'[Time]),[Attribute]=MIN('Table'[Attribute])))
Measure2 = CALCULATE(SUM('Table'[Value]),FILTER(ALLEXCEPT('Table','Table'[Time]),[Attribute]=MAX('Table'[Attribute])))
Difference = [Measure2]-[Measure1]
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The field parameter feature is for cases like yours.
https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters
Thank you very much!
I will try it within the next days and will let you know.
Teally appriciate your support :).
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
22 | |
17 | |
11 | |
11 | |
10 |
User | Count |
---|---|
31 | |
25 | |
15 | |
13 | |
12 |