Problem with Understanding AllSELECTED

Source Database: WideWorldImportersDW-Full.bak
As ALLSELECTED clears the implicit filter for visual it is used in only and keep explicit filter coming from slicer or other visuals.

Running Total (AllSELECTED ) Of Quantity = CALCULATE([Total Sales Quantity],
FILTER( ALLSELECTED('Dimension Date'),
MAX('Dimension Date'[Date])>='Dimension Date'[Date]
)
)

Its hard to understand why below code related to ALLSELECTED in above expression is not re initiating running total for selected calendar year label in slicer

ALLSELECTED('Dimension Date'[Date])

It seems like specifying Dimension Date table only and specific column provide all Dimension Date range for selected calendar year and hence re-initiating running total.

If that is the case then how can we re-instate running total while using Calendar year label as slicer.

Thanks,
Harry

ALLSelected is probably one of the hardest, if not the hardest, function in DAX. While on the outside it looks easy and usually performs as you would expect, the “how” it works can be confusing. ALLSELECT doesnt “know” what the user has selected, though it would appear to. It “simply” ignores the current filter context and “Goes back” to the one preceding it, which most of the time it would be the fitler context generated by a slicer or table. If you have multiple filter contextes and context transitions happening in a function, you would really need to have a firm grasp of what is really happening at each step.

Do you have a specific example of what you are trying to accomplish?

1 Like

So on my Power BI canvas there’s a single visual which will have Date (as hierarchy i.e. default), total Quantity and a running total along with same (SS Below).

Along with another visual Calendar Year label as a slicer.

But i like to evaluate this expression using ALLSELECTED.

Where AllSELECTED should be using column exclusively instead of tables i.e. ALLSELECTED(column1,column2 and soon) .

Is you see this search I’ve done in the forum, there are plenty of examples on ALLSELECTED here to review.

https://forum.enterprisedna.co/search?expanded=true&q=%23enterprise-dna-online%20allselected

This one here is particular good

My recommendation with ALLSELECTED is not to over think it. Just think that it removes the context from a table or column, but only up to what is selected within the report page (whereas ALL doesn’t care what you have selected, it will always ignore it)

Thanks
Sam