Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi,
I'm trying to create a measure that can count the number of rows found within a specific month and year. Thanks for any help!
Hi,
Unless someone knows a better way, I created month and year columns from my date column then used this DAX statement:
Current Month =
CALCULATE(COUNTROWS(vwServiceDeskWorkOrder), vwServiceDeskWorkOrder[ResolvedMonth] = 8,
FILTER(vwServiceDeskWorkOrder, vwServiceDeskWorkOrder[ResolvedYear] = 2017)
)
You could do that with a simpler measure:
=CALCULATE ( COUNTROWS ( YourTable ), MONTH ( YourTable[Date] ) = 8, YEAR ( YourTable[Date] ) = 2008 )
Not that your solution is a wrong one (besides, at query time your solution is faster on very large models), just to note that you could do that with a measure. 🙂
Have fun with DAX!
Alberto Ferrari
http://www.sqlbi.com
Hi Alberto ,
For the below solution this will give only for the month 8th .... Now if i have to present for whole year what is the measure ? can you please advice >?
Well, just remove the month part, not that complex 🙂
Thanks! I thought I tried that but it didn't work for me. I'll verify again.
User | Count |
---|---|
125 | |
106 | |
99 | |
63 | |
62 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |