Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi @ahmed_MEJRI ,
I have created a fact table like this:
A date table by this measure:
Calendar = CALENDAR("2020/4/30","2020/6/15")
Create a measure like this and use two slicers:
Measure =
VAR _minA =
CALCULATE ( MIN ( 'Calendar'[Date] ), ALLSELECTED ( 'Calendar'[Date] ) )
VAR _maxA =
CALCULATE ( MAX ( 'Calendar'[Date] ), ALLSELECTED ( 'Calendar'[Date] ) )
VAR _minB =
CALCULATE ( MIN ( 'Table'[date] ), ALLSELECTED ( 'Table'[date] ) )
VAR _maxB =
CALCULATE ( MAX ( 'Table'[date] ), ALLSELECTED ( 'Table'[date] ) )
RETURN
CALCULATE (
SUM ( 'Table'[value] ),
'Table'[date] >= _minA
&& 'Table'[date] <= _maxA,
'Table'[date] >= _minB
&& 'Table'[date] <= _maxB
)
Here is my sample file that hopes to help you: Calculate sum(amount) with 2 different periods.pbix
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
thanks for this idea , is it possible to use 2 sum measures (different periods , slicers) and calculate the variance in a single table : it will be fantastic : how can we do that ?
@ahmed_MEJRI , can explain with an example. I thought this what needed
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601