Forum Discussion
Count entries in custom table
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;
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/
4 Replies
- amitchandak
Super User
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/
- AnonymousNot applicable
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.
- AnonymousNot applicable
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
- AnonymousNot applicable
Thank you for this additional info. I will look at it also.