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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Including a date filter in a DAX measure

Hi all
 
I am trying to filter a sum of expenses by the item. I have done the following:
 
= CALCULATE(SUM(costofsales[Cost of Sales Expense]), FILTER(costofsales,costofsales[Cost of Sales Item]="Wages - Trainers Training Delivery (Contract)" || costofsales[Cost of Sales Item]="Training - Venue Hire" || costofsales[Cost of Sales Item]="Training - Resources & Printing" || costofsales[Cost of Sales Item]="Training - Accommodation" || costofsales[Date] > DATE(2021,5,31)))
 
It is providing me with the incorrect answer. 
I need the filter to contain all of the above sales items but only include those that have a date after 31 May 21. 
 
Any assistance would be great. 
Thanks. 
 
Karen
2 ACCEPTED SOLUTIONS
Jos_Woolley
Solution Sage
Solution Sage

Hi,

Measure =
CALCULATE (
    SUM ( costofsales[Cost of Sales Expense] ),
    costofsales[Cost of Sales Item]
        IN {
        "Wages - Trainers Training Delivery (Contract)",
        "Training - Venue Hire",
        "Training - Resources & Printing",
        "Training - Accommodation"
    },
    costofsales[Date] > DATE ( 2021, 5, 31 )
)

Regards

View solution in original post

Have you tried combining NOT with IN?

Regards

View solution in original post

8 REPLIES 8
Jos_Woolley
Solution Sage
Solution Sage

Hi,

Measure =
CALCULATE (
    SUM ( costofsales[Cost of Sales Expense] ),
    costofsales[Cost of Sales Item]
        IN {
        "Wages - Trainers Training Delivery (Contract)",
        "Training - Venue Hire",
        "Training - Resources & Printing",
        "Training - Accommodation"
    },
    costofsales[Date] > DATE ( 2021, 5, 31 )
)

Regards

Anonymous
Not applicable

Hi Jos Thank you. I knew it would be something simple. 

Appreciate your prompt reply. 😀

 

Sure! You're very welcome!

 

Cheers

Anonymous
Not applicable

Hi Jos

 

IRT my query above, how do I do "does not contain" those fields? Instead of the IN is there another function I use? I have been looking and trying different things but I haven't got it. Are you able to help me out? 

Have you tried combining NOT with IN?

Regards

Anonymous
Not applicable

Thank you @Jos_Woolley Tried that and it worked like a charm. Appreciate your guidance with that one. 

Cheers

Karen

Great stuff, glad to know! Cheers, Karen.

Jos

Anonymous
Not applicable

Yes, but I think I put them in the wrong place/order. I will have another go at that and see how I go. Thank you for the push in the right direction. 

Cheers

Karen

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.