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.
Dear All,
I am working on Attendance report in Power BI , below DAX is working fine for "P" & "WO" , but the moment i add "A" in else part of Switch, it return entire year value in table , instead of selected month from Slicer ,Any suggestion or advice much appreciate, Thank you ,
_Attendance = SWITCH(TRUE(),
COUNTROWS(FILTER(Sheet2 , Sheet2[Login Date] >= RELATED('Calendar'[Date] ) )) = 1,"P",
FORMAT(SELECTEDVALUE('Calendar'[Date]),"DDD") = "Fri" || FORMAT( SELECTEDVALUE('Calendar'[Date]),"DDD")= "Sat", "WO")
Thank you for your reply,
ihave little modified DAX : SWITCH to IF , and as suggested instead of A , i have used
so with this change , 2 things are fixed, one now its only showing selected month date, and instead of blank its is now showing "A",
:>>>
now there one thing which is slight concern, for future date it is also showing "A", where for for future date it is expected as Blank
Does it help if you use SELECTEDVALUE ( 'Calendar'[Date], "A" ) instead of "A" for the else default value?
This should still return blanks when the date is outside of your selected range.
User | Count |
---|---|
15 | |
13 | |
8 | |
6 | |
6 |
User | Count |
---|---|
24 | |
19 | |
12 | |
9 | |
7 |