Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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 |
---|---|
98 | |
76 | |
76 | |
48 | |
26 |