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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Steph83
Frequent Visitor

FILTER DATE IN DAX

Good day,

I have a measure that calculate the number of ressources needed based on a number of vessels ([NBR VESSELS GC]) . The number of vessels is increasing on a monthly basis.

 
NB ENGINEER NEEDS  = if([NBR VESSELS GC]>52,14,if([NBR VESSELS GC]>48,13,if([NBR VESSELS GC]>44,12,if([NBR VESSELS GC]>40,11,if([NBR VESSELS GC]>36,10,if([NBR VESSELS GC]>32,9,if([NBR VESSELS GC]>28,8,if([NBR VESSELS GC]>24,7,if([NBR VESSELS GC]>20,6,if([NBR VESSELS GC]>16,5,if([NBR VESSELS GC]>12,4,if([NBR VESSELS GC]>8,3,if([NBR VESSELS GC]>4,2,if([NBR VESSELS GC]>1,1,0))))))))))))))
 
I need to create a measure that calculate the number of ressources needed on the 01/01/2024 minus the ressources needed on the 01/01/2023. 
I tried with CALCULATE but I have an error (True/False expression does not sepcify a column)
 
 Needs 2023 = CALCULATE([NB GC ENGINEER NEEDS MRS],DATE(2024,01,01))- CALCULATE([NB GC ENGINEER NEEDS MRS],DATE(2023,01,01))
 
I'm fumbling and I am at the lowest level of knowledge in DAX but I do not despair of progressing!
 
Thanks for your support
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Steph83 , the error means that the Power BI does not know what to compare the DATE value against. What is the Date field in the fact table? For an example, if your fact table is called 'FactVessels' and the date field is [Date], then your measure might work something like this:

 

Needs 2023 = CALCULATE([NB GC ENGINEER NEEDS MRS],'factVessels'[Date] = DATE(2024,01,01))- CALCULATE([NB GC ENGINEER NEEDS MRS],'factVessels'[Date] = DATE(2023,01,01))

View solution in original post

3 REPLIES 3
vanessafvg
Super User
Super User

you will need to provide some sample data, as well as what your expected result from that sample data is.

 

this is not enough information without understanding how your data is structured.

 

I also think using a switch statement for your nested if statements is recommended because the readability is very difficult with what you doing.   However if you provide sample data with your expected result from that data, there might be a easier way to calculate this.

 

 

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Anonymous
Not applicable

@Steph83 , the error means that the Power BI does not know what to compare the DATE value against. What is the Date field in the fact table? For an example, if your fact table is called 'FactVessels' and the date field is [Date], then your measure might work something like this:

 

Needs 2023 = CALCULATE([NB GC ENGINEER NEEDS MRS],'factVessels'[Date] = DATE(2024,01,01))- CALCULATE([NB GC ENGINEER NEEDS MRS],'factVessels'[Date] = DATE(2023,01,01))

It works, thanks!

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 Kudoed Authors