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.
Hallo All,
I am trying to count the number of entries on a Date table column, but it should be dynamic in the sense that I am using 3 fields from the date table namely, year, month and day. The point is, if I drill the graph to year it should count the number of years over allselected, month the number of months and days the number of days. The measure I am currently trying to do this with is as follows;
Solved! Go to Solution.
@Anonymous , I think it should some role of what if selected
some thing like this
measure =
var _Expression=if(ISFILTERED('Date'[Month Year]),values(Date[Month-year]),if(ISFILTERED('Date'[Year]),Values(Date[Year]),Values(Date[Date])))
return
countx(_Expression,Date[Date])
Also, other examples where measures have been filtered
https://powerpivotpro.com/2013/03/hasonevalue-vs-isfiltered-vs-hasonefilter/
Hi @Anonymous,
I'd like to suggest you take a look at below blog about how to handle the different hierarchy levels:
Clever Hierarchy Handling in DAX
Regards,
Xiaoxin Sheng
Thank you for this additional info. I will look at it also.
@Anonymous , I think it should some role of what if selected
some thing like this
measure =
var _Expression=if(ISFILTERED('Date'[Month Year]),values(Date[Month-year]),if(ISFILTERED('Date'[Year]),Values(Date[Year]),Values(Date[Date])))
return
countx(_Expression,Date[Date])
Also, other examples where measures have been filtered
https://powerpivotpro.com/2013/03/hasonevalue-vs-isfiltered-vs-hasonefilter/
So I already tried something similar where I calculate the count of years, months and days in separate variables and return it in such an isfiltered IF statement, similar to yours and that did not work. But, you second link made me understand something about hasonefilter and the same measure as above works very will with hasonefilter. Thank you for your help.
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 |
---|---|
113 | |
97 | |
84 | |
67 | |
60 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |