DAX formulas working, but wont give correct result when slicer changes made.

countryfan_nt

Well-known Member
Joined
May 19, 2004
Messages
758
Hello friends, hope all is well! please help.

The following DAX formulas works fine, and displays the average, max and min of values of all branches.
= CALCULATE(average(DB[LTM]), FILTER( DB, DB[Year]=earlier(DB[Year])&&DB[Month]=earlier(DB[Month])&&DB[Item]=earlier(DB[Item])) )
= CALCULATE(MAX(DB[LTM]), FILTER( DB, DB[Year]=earlier(DB[Year])&&DB[Month]=earlier(DB[Month])&&DB[Item]=earlier(DB[Item])) )
= CALCULATE(MIN(DB[LTM]), FILTER( DB, DB[Year]=earlier(DB[Year])&&DB[Month]=earlier(DB[Month])&&DB[Item]=earlier(DB[Item])) )

problem is I don't get the correct average, min, or max if I choose less branches through the slicers. (i.e. all branches have to be selected).

I wish for the formula to adjust based on the slicer selections. can that be done?

thank you so much in advance!
1.PNG
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Possibly your slicer is looking at old cached data. In all my powerqueries and powerpivot sheets I got a macro to 'refresh' the caches linked to a buttonshape with the respective macro assigned. It's with complex setups rather slow hence why MS is likely to have chosen to go the cache route. A Snip from my code

VBA Code:
140             With pt.PivotCache '26.05.2019 with merges
150                 .MissingItemsLimit = xlMissingItemsNone: .MissingItemsLimit = xlMissingItemsDefault: .Refresh
190             End With 'pt.
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,214,667
Messages
6,120,808
Members
448,990
Latest member
rohitsomani

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top