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 have the following formula:
Measure = CALCULATE(COUNT(table[column]); PREVIOUSYEAR(table[dates]))
which dies due to duplicate values in table[dates], which is apparently not supported by PREVIOUSYEAR (is there a particular reason why it cannot handle duplicates?), so I have modified the expression as follows:
Measure = CALCULATE(COUNT(table[column]); PREVIOUSYEAR(DISTINCT(table[dates])))
which again dies due to duplicate values. How is it possible that DISTINCT returns duplicates? I based the expressions on the official quick start basics and the function definitions:
https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-quickstart-learn-dax-basics/
https://msdn.microsoft.com/en-us/library/ee634770.aspx
https://msdn.microsoft.com/en-us/library/ee634943.aspx
Thank you for your help guys!
Solved! Go to Solution.
@Anonymous yes you do its best practice when using date functions
its easy to create one to either use the calendarauto() function in dax, or i usually go for this
https://www.mattmasson.com/2014/02/creating-a-date-dimension-with-a-power-query-script/
link your date to your date (that will remove the duplication, as date functions expect continous data)
Proud to be a Super User!
@Anonymous you need to use a date table, have you got one?
Proud to be a Super User!
I have only one table with the data and a column with dates. Do I need a separate table?
@Anonymous yes you do its best practice when using date functions
its easy to create one to either use the calendarauto() function in dax, or i usually go for this
https://www.mattmasson.com/2014/02/creating-a-date-dimension-with-a-power-query-script/
link your date to your date (that will remove the duplication, as date functions expect continous data)
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 |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |