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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
EsterBR
Helper II
Helper II

Compare calculate the difference according to the date selected in 2 tables

Hi,

 

I have the following tables with date slicers and 2 different dates selected. I would like to create a measure that shows the difference in sales between the tables. the result shoud be 2 (1001-1003). How can I achieve that? Thank you so much!

EsterBR_1-1714742091707.png

 

1 ACCEPTED SOLUTION
v-tianyich-msft
Community Support
Community Support

Hi @EsterBR ,

 

I made simple samples and you can check the results below:

vtianyichmsft_0-1715764635698.png

Measure 2 = var _s1= SELECTEDVALUE('Table 2'[Date])
var _s2= SELECTEDVALUE('Table 3'[Date])
RETURN SUMX(FILTER('Table',MONTH([Date])=MONTH(_s1)),[Value]) - SUMX(FILTER('Table',MONTH([Date])=MONTH(_s2)),[Value])

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-tianyich-msft
Community Support
Community Support

Hi @EsterBR ,

 

I made simple samples and you can check the results below:

vtianyichmsft_0-1715764635698.png

Measure 2 = var _s1= SELECTEDVALUE('Table 2'[Date])
var _s2= SELECTEDVALUE('Table 3'[Date])
RETURN SUMX(FILTER('Table',MONTH([Date])=MONTH(_s1)),[Value]) - SUMX(FILTER('Table',MONTH([Date])=MONTH(_s2)),[Value])

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Ritaf1983
Super User
Super User

Hi @EsterBR 
Please refer to my solution in the linked discussion, it includes a pbix to follow :

https://community.fabric.microsoft.com/t5/Desktop/Dynamic-comparison-with-two-slicers/m-p/3847255#M1...

you should apply the same logic on date tables.

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

Hi @Ritaf1983, Thanks for the answer but unfortunately I cannot create the same data model in my dashboard.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.