Forum Discussion
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.
- Anonymous4 years ago
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))
3 Replies
- AnonymousNot 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))- Steph83Frequent Visitor
It works, thanks!
- vanessafvg
Community Champion
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.