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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
dpombal
Post Partisan
Post Partisan

Get the maximum sum of sales for all dates

Hi all ,I am facing problems with a quite basic Dax formula, in fact looks like a bug ( I am using Power bi desktop Version: 2.129.1229.0 64-bit (May 2024)).

 

Download sample PBIX link https://1drv.ms/u/s!Am7buNMZi-gwhJ5EZUHgExUn_dUgeA?e=j1qr6U

 

 

My datatset is a basic SalesT table with 4 columns: a sales person (Firstname), SessionType (needs to be filtered), Date and SalesAmount.

SalesT tableSalesT table

 

What I am looking for is the maximum sum of sales grouped by date for all dates, so I need to retrieve for all dates the sum of sales amount and finally select the maximum value. Session types must be filtered to exclude AllDay and Prepare values as shown in below image.

When FirstName and Date are not filtered the value for the measure SalesMaxDate should be 300.

Image 01

no filtersno filters

 

However when filtering Date Day 7th of May, the value of the measure changes. Correct value should be 300 but measure shows 290

Image02

filtered  day 7 of Month Mayfiltered day 7 of Month May

Same behaviour when filtering Date=Day 7th of May and  FirstName=Paul. Correct value should be 200 but measure shows 175

Image03

Filtered Name and DateFiltered Name and Date

 

I tried with 2 sample measures with no luck to Remove Date field filter and summarize to get the value I am looking for.

 

SalesMaxDatev1 =

MAXX (

CALCULATETABLE ( VALUES(SalesT[Date]),

                 REMOVEFILTERS ( SalesT[Date] )

                 ),

CALCULATE ( sum(SalesT[SalesAmount]))

)

 

Measure  version 2

 

SalesMaxDatev2 = MAXX (


CALCULATETABLE (


SUMMARIZE (SalesT,

                         SalesT[Date] ,

                         "SUMSALESBYDAY", sum(SalesT[SalesAmount]) )

,

REMOVEFILTERS ( SalesT[Date]  )


) , [SUMSALESBYDAY])

 

 

Regards

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,@dpombal 

Regarding the issue you raised, my solution is as follows:

The reason why the maximum value is not 300 is because of the influence of the slicer "session type". When you select the two dates, the slicer "session type" also follows the time slicer and filters only the value whose session type is night, as shown in the figure below. Thus the maximum value is returned to 290.

vlinyulumsft_0-1718082183996.png

I offer you two solutions:

1.The first method, to manage the relationship between visual objects, disconnects the relationship between the date slicer and the two maximum visual objects, as shown below:

vlinyulumsft_1-1718082208944.png

The following documents are relevant to help you:

Change how visuals interact in a report - Power BI | Microsoft Learn

 

2.The second method:

Create a new table with a date column to ensure that the date slicer does not affect the "session type" of the slicer:

Table = SELECTCOLUMNS('SalesT',"Date",'SalesT'[Date])

Use the date column of the new table as the new slicer:

vlinyulumsft_2-1718082263056.png

Here are the measure for replacing the bar chart visual object:

Measure = 
VAR cc=VALUES('Table'[Date])
RETURN CALCULATE(SUM(SalesT[SalesAmount]),FILTER(SalesT,'SalesT'[Date] IN cc))

vlinyulumsft_3-1718082291361.png

 

3.Here are the final results:

vlinyulumsft_4-1718082315587.png

vlinyulumsft_5-1718082323947.png

vlinyulumsft_6-1718082335578.png

vlinyulumsft_7-1718082343004.png

 

Please find the attached pbix relevant to the case.

Method 1 is in Page 1, Method 2 is in page2

 

Best Regards,

Leroy Lu

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

2 REPLIES 2
Anonymous
Not applicable

Hi,@dpombal 

Regarding the issue you raised, my solution is as follows:

The reason why the maximum value is not 300 is because of the influence of the slicer "session type". When you select the two dates, the slicer "session type" also follows the time slicer and filters only the value whose session type is night, as shown in the figure below. Thus the maximum value is returned to 290.

vlinyulumsft_0-1718082183996.png

I offer you two solutions:

1.The first method, to manage the relationship between visual objects, disconnects the relationship between the date slicer and the two maximum visual objects, as shown below:

vlinyulumsft_1-1718082208944.png

The following documents are relevant to help you:

Change how visuals interact in a report - Power BI | Microsoft Learn

 

2.The second method:

Create a new table with a date column to ensure that the date slicer does not affect the "session type" of the slicer:

Table = SELECTCOLUMNS('SalesT',"Date",'SalesT'[Date])

Use the date column of the new table as the new slicer:

vlinyulumsft_2-1718082263056.png

Here are the measure for replacing the bar chart visual object:

Measure = 
VAR cc=VALUES('Table'[Date])
RETURN CALCULATE(SUM(SalesT[SalesAmount]),FILTER(SalesT,'SalesT'[Date] IN cc))

vlinyulumsft_3-1718082291361.png

 

3.Here are the final results:

vlinyulumsft_4-1718082315587.png

vlinyulumsft_5-1718082323947.png

vlinyulumsft_6-1718082335578.png

vlinyulumsft_7-1718082343004.png

 

Please find the attached pbix relevant to the case.

Method 1 is in Page 1, Method 2 is in page2

 

Best Regards,

Leroy Lu

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

 

 

 

With the SessionType influence you give me the tip I was looking for,

I will try to do an extra option 3 adding to my DAX formula with a fixed filter excluding  SessionType ("AllDay","Prepare").

 

SUMMARIZE(     FILTER('SalesT',                      
NOT ( 'SalesT'[SessionType ) IN { "AllDay","Prepare"}
....
                                          )

 

Regards

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors