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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
uva0224
Frequent Visitor

Max of a sum measure when using slicer, using dax?

See the pic below:

2100 is the sum of 'total monthly order' over 3 months for a display.

However, some items are not offered in all 3 months, so they don't all 3 rows in the raw data. So the sum caluated 2 month total insead 1350.

Is there any way using DAX to force 2100 on 1350 while keep the flexiablity of the the monthly slicer?

I can solve it in SQL, but not very good in DAX.

Thank you so much!

 

 

uva0224_0-1619645195986.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @uva0224 ,

 

Based on your description, I did a test. 

Here is my test table.

v-yuaj-msft_0-1620006591858.png

Then I created a measure as follows.

sum_date =
SUMX (
    FILTER (
        ALL ( 'Table' ),
        [Date] < DATE ( 2021, 4, 1 )
            && [Date] >= DATE ( 2021, 1, 1 )
    ),
    [Value]
)

Result:

v-yuaj-msft_1-1620006685549.png

You could add "ALL()" function before the table and specify the scope of date to limit the rows to be calculated.

Is the result what you want?

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please share some sample data and the expected result to have a clear understanding of your question? I can do some tests for you.

You can save your files in some cloud sharing platforms and share the link here. (screenshots are as well)

How to provide sample data in the Power BI Forum - Microsoft Power BI Community

 

Best Regards,

Yuna

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @uva0224 ,

 

Based on your description, I did a test. 

Here is my test table.

v-yuaj-msft_0-1620006591858.png

Then I created a measure as follows.

sum_date =
SUMX (
    FILTER (
        ALL ( 'Table' ),
        [Date] < DATE ( 2021, 4, 1 )
            && [Date] >= DATE ( 2021, 1, 1 )
    ),
    [Value]
)

Result:

v-yuaj-msft_1-1620006685549.png

You could add "ALL()" function before the table and specify the scope of date to limit the rows to be calculated.

Is the result what you want?

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please share some sample data and the expected result to have a clear understanding of your question? I can do some tests for you.

You can save your files in some cloud sharing platforms and share the link here. (screenshots are as well)

How to provide sample data in the Power BI Forum - Microsoft Power BI Community

 

Best Regards,

Yuna

uva0224
Frequent Visitor

Help. please! thx

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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