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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Analitika
Post Prodigy
Post Prodigy

How to filter calculations according to end date of slicer?

Hello,

 

I would like to ask how to make a measure which calculates sum according to the end date of slicer. I mean when we turn left or turn right this: 

Analitika_0-1641282205723.png

I have used this expression but it didn't help me 

filter('Date', 'Date'[Date] =maxx(allselected('Date') , 'Date'[Date])).
1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi, @Analitika 

 

You should use all tables and save 'maxdate' as a variable first, otherwise it will be affected.

Try like this:

maxdatetotalvalue =
VAR maxdate =
    MAXX ( ALLSELECTED ( 'Table1' ), [Date] )
RETURN
    SUMX ( FILTER ( ALL ( 'Table1' ), [Date] = maxdate ), [Value] )

vjaneygmsft_0-1641538200657.png

Below is my sample and two wrong results for reference.

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
 
Best Regards,
Community Support Team _ Janey

View solution in original post

3 REPLIES 3
v-janeyg-msft
Community Support
Community Support

Hi, @Analitika 

 

You should use all tables and save 'maxdate' as a variable first, otherwise it will be affected.

Try like this:

maxdatetotalvalue =
VAR maxdate =
    MAXX ( ALLSELECTED ( 'Table1' ), [Date] )
RETURN
    SUMX ( FILTER ( ALL ( 'Table1' ), [Date] = maxdate ), [Value] )

vjaneygmsft_0-1641538200657.png

Below is my sample and two wrong results for reference.

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
 
Best Regards,
Community Support Team _ Janey
Samarth_18
Community Champion
Community Champion

Hi @Analitika ,

 

I can more specifically if you could share sample data in text format with expected output.

But you can try below code:-

measure =
VAR _start_date =
    MIN ( date[date] )
VAR _end_date =
    MAX ( date[date] )
RETURN
    CALCULATE (
        SUM ( table[column] ),
        table[date] >= _start_date
            && table[date] <= _end_date
    )

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Analitika_0-1641283160504.png

But it didn't work.

Here is my formula.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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