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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cnewell7
Helper II
Helper II

DAX respect only one slicer

Dear All

 

Here is the situation:

 

I have two slicers allowing a user to select Month (MonthLong) & Year respectively. Both are columns in my calendar table

 

Without selecting any particular months in the month slicer the DAX expression below works fine. I get a value returned which is at a year level

 

However, if I select a Month I would expect the measure to respect the month filter being applied to the calendar table. It is does not and I just get the same figure at year level

 

Have gone about constructing the expression with best intentions but obviously missing something, help much appreciated

 

 

LY ACTUAL =
VAR LY_VAL = [LY] // derive LY value from users selection of year
RETURN
CALCULATE (
[PL_TOTAL],
DIM_DTYPE[DTYPE] = "ACT",
FILTER(ALLEXCEPT(DIM_CALENDAR, DIM_CALENDAR[MonthLong]), DIM_CALENDAR[Year]= LY_VAL )
)

3 REPLIES 3
Greg_Deckler
Super User
Super User

Sample data to match up with your formula would be very beneficial.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

I've actually found a workaround to what I needed (DATEADD) but am mystified as to why this doesn't work

 

I'm basically saying "don't disregard the selection in the month slicer' but it is doing. So the question would be why is ALLEXCEPT not doing what its supposed to ?

 

If you want to skype me it would be easier to show you

 

PS the reason I hold the value of a measure in a variable is because if i use the measure directly in my filter expression it doesn't work

 

Hi @cnewell7,

 

Could post your table structures(including the relationships) with some sample/mock data which can help us to reproduce this issue, so that we can help further investigate on it? It's better that you can share a sample pbix file(with just some sample/mock data) which can reproduce the issue. You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading. Smiley Happy

 

Regards

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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