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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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