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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Safus09
Regular Visitor

Use two distinct filters and apply sum to data

Hi,  

I want to sum the Amount after using two distinct Period Values coming from two distinct filter. 

Filter1 = Period1 => Select the first date of the period which is 01/01/2023
Filter2 = Period3 => Select the LastDate of the period which is 31/03/2023

The sum should be : 100 + 150 + 200 + 200 + 500 + 600 


My Data : 

PeriodDateAmount
101-01-2023100
121-01-2023150
201-02-2023200
210-02-2023200
317-03-2023500
324-03-2023600
...  
1201-12-20231200
1231-12-20235000



Using a slicer for dates works fine and it's not a big deal. But I don't know how to do the same by seperating the filters. 

Thank you

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Safus09 

 

Please try this:
I select two date in the filter:

vzhengdxumsft_0-1712201199132.png

Then add a measure:

MEASURE =
VAR _maxDate =
    CALCULATE ( MAX ( 'Table'[Date] ), ALLSELECTED ( 'Table' ) )
VAR _minDate =
    CALCULATE ( MIN ( 'Table'[Date] ), ALLSELECTED ( 'Table' ) )
RETURN
    CALCULATE (
        SUM ( 'Table'[Amount] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Date] >= _minDate
                && 'Table'[Date] <= _maxDate
        )
    )

The result(150 +200 +200 +500) is as follow:

vzhengdxumsft_1-1712201275035.png

Best Regards

Zhengdong Xu
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
Ashish_Mathur
Super User
Super User

Hi,

What is you create just one slicer for the period (set to the between format).  Select 1 to 3 in the slicer.  Then just write this measure and drag it to a card visual

Measure = sum(Data[Amount])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Safus09 

 

Please try this:
I select two date in the filter:

vzhengdxumsft_0-1712201199132.png

Then add a measure:

MEASURE =
VAR _maxDate =
    CALCULATE ( MAX ( 'Table'[Date] ), ALLSELECTED ( 'Table' ) )
VAR _minDate =
    CALCULATE ( MIN ( 'Table'[Date] ), ALLSELECTED ( 'Table' ) )
RETURN
    CALCULATE (
        SUM ( 'Table'[Amount] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Date] >= _minDate
                && 'Table'[Date] <= _maxDate
        )
    )

The result(150 +200 +200 +500) is as follow:

vzhengdxumsft_1-1712201275035.png

Best Regards

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

 

Bmejia
Super User
Super User

Are you looking for just another slicer for the period like this.  If that is what you want then you need to format the Period column to a numeric value.  Also make sure that you do not have anything but numbers in this column no "...".  Then just add a slicer similar to date slicer and add Period.  

Bmejia_0-1712176706708.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors