Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
BItoken
Helper III
Helper III

Difference between Column values in a Matrix

Hi,

 

I have a simple table with a date where the user will be able to select 2 dates and see the difference in Sum of Sales value between the selected dates as shown in the screen shot below.

User will be forced to select only 2 dates .

How do we achieve the difference instead of the sum of the selected 2 dates.

BItoken_0-1627447361628.png

Attached is the link to the sample PBIX 

https://www.dropbox.com/s/cy2buewqw5bkj9c/test.pbix?dl=0

 

1 ACCEPTED SOLUTION

Picture1.png

 

https://www.dropbox.com/s/tct0pkypz9c7dgr/Test.pbix?dl=0 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Picture1.png

 

Diff measure : =
VAR _mindate =
CALCULATE ( MIN ( pbitest[rep_date] ), REMOVEFILTERS ( pbitest ) )
VAR _maxdate =
CALCULATE ( MAX ( pbitest[rep_date] ), REMOVEFILTERS ( pbitest ) )
VAR _diff =
CALCULATE ( SUM ( pbitest[atr] ), pbitest[rep_date] = _mindate )
- CALCULATE ( SUM ( pbitest[atr] ), pbitest[rep_date] = _maxdate )
RETURN
IF ( HASONEVALUE ( pbitest[rep_date] ), SUM ( pbitest[atr] ), _diff )

 

 

Link to the sample pbix file 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

@Jihwan_Kim Thanks for the response.

I tried creating this measure and row level differences are correct but i still see issue at the grand total of the Total (Difference).

The total difference for the 2 selected dates must be 701 as per the below screenshot

(250-149+600) but the total shows -329 (Looks like this -329 is consistent no matter what dates we select)

BItoken_0-1627497004125.png

Picture1.png

 

https://www.dropbox.com/s/tct0pkypz9c7dgr/Test.pbix?dl=0 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thank u @Jihwan_Kim  it works now

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.