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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Solle
Helper III
Helper III

Summarize between selected dates from slicer

Hi All,

I have a measure named "Afkast - Month Afkast" which generates each month return. Then I have a slicer which is using "between" as the style. What I want to accomplish is to generate the sum of monthly returns between two dates selected from the slicer. 

I have tried the below code, but this just gives me from the start of the dates till the selected max value in the data slicer. So it is ignoring the start date in the slicer. 

Afkast - Period Afkast = 
VAR v2 = 
SUMMARIZE(
    FILTER(
        'DimDate',
        'DimDate'[Date]>=MIN(DimDate[Date]) && 'DimDate'[Date]<= MAX('DimDate'[Date])
        ),
        'DimDate'[Date],"Sum",[Afkast - Month afkast])

RETURN
SUMX(v2,[sum])
     
Does anyone know how to accomplish this? Unfortunately I have to have month returns as a measure due to the data structure.

Best Regards,
Solle
3 REPLIES 3
tamerj1
Super User
Super User

HI @Solle 
What is the dax for [Afkast - Month afkast]?

Hi @tamerj1 
The dax for that measure is 

Afkast - Month afkast = 
    IF(
        MONTH(SELECTEDVALUE('DimDate'[Date]))=1,
            SUM('FactAfkast'[Afkast eksl. FX]),
            SUM(FactAfkast[Afkast eksl. FX])-[Afkast - Previous month afkast])


Let me know if you have any additional questions. 

Best Regards,
Solle

And for the measure "Afkast - Previous Month Afkast" it is

Afkast - Previous month afkast = 
        CALCULATE(SUM('FactAfkast'[Afkast eksl. FX]),PREVIOUSMONTH('DimDate'[Date]))

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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