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.
I am very new to Power BI and I am having a hard time converting a sql statement to dax. I work in law enforcement and need to count the number of cases we have had during a certain date range in a 10 year period. For example January 1 - June 15 for the years 2010 - 2019. Following is my current sql statement:
WHERE (((Year([DATEOFDEAT]))>=2010) AND ((Month([DATEOFDEAT])) Between 1 And 5) AND ((Day([DATEOFDEAT]))<Date())) OR (((Year([DATEOFDEAT]))>=2010) AND ((Month([DATEOFDEAT]))=6) AND ((Day([DATEOFDEAT])) Between 1 And 15))
As a workaround, I created one dax statement for each year. So, ten total dax statements for one report tile which feels like overkill. Here is an example of the dax for year 2010:
Solved! Go to Solution.
@Anonymous
If you want to use my idea of a MonthDay, you can create this calculated column in your datetable: (replace 'Table 2'[Date] references to your table name and date column):
MonthDay = VALUE(CONCATENATE(FORMAT(MONTH('Table 2'[Date]), "#"), FORMAT(DAY('Table 2'[Date]), "0#")))
Outcome:
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |