The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello,
I had trouble with dax function while trying to get data with 2 filters. There are This week and last week of year 2023.
Currently, i have dax function that can get data
Last week: Calculate(Countrows'Table'),Filter('Table',[Weeknum]=Max[weeknum] -1)
This week: Calculate(Countrows'Table'),Filter('Table',[Weeknum]=Max[weeknum])
Everything is fine until data passed to 2023, my Max[weeknum] isn't correct anymore because the Max[weeknum] is on 2022.
Tried dax function: Calculate(Countrows'Table'),Filter('Table',[Weeknum]=Max[weeknum] && [Year]=2023) but it returns blank value.
Thanks & Regards,
Hoai Phong
You need to create a column in the calendar table
WEEK Order =DATEDIFF(TODAY(),[Date],WEEK))
further like this
This week = CALCULATE([Value sum],'Calendar'[WEEK Order]=0)
Last week = CALCULATE([Value sum],'Calendar'[WEEK Order]=-1)
Hi,
Thank you for reply. But i still can't figure how to use DATEDIFF to solve my problem.
I want to countrows with 2 filters. There are 2023 in year column and maximum weeknum of 2023.
Thanks & Regards,
Hoai Phong
User | Count |
---|---|
65 | |
60 | |
55 | |
54 | |
31 |
User | Count |
---|---|
180 | |
88 | |
70 | |
46 | |
46 |