Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
I am trying to calculate Least popular day using the following DAX, but I am getting the fixed result ( Friday ) although there is no value ( blank) in friday, I think the result is fixed Friday is only for that I am using fixed N-Value 5, is there any way we can set the N-Value dynamically?
LeastPopularDayOfWk=
FIRSTNONBLANK (
TOPN (
5,
CALCULATETABLE (
VALUES ( DimDayName[DayName] ),
FILTER ( DimWP, DimWP[WP] <> "Remote" )
),
[%Of_Attendance_By_DayForM/LPD]
),
1
)
Solved! Go to Solution.
Hi @arif_tsrm ,
I do some changes on my DAX codes.
Measure 2 =
VAR _A =
MINX (
FILTER ( 'Table', NOT ( ISBLANK ( 'Table'[Attendance] ) ) ),
'Table'[Attendance]
)
RETURN
LOOKUPVALUE ( 'Table'[DayShort], 'Table'[Attendance], _A )
Then you can see that it will return you the smallest value other than blank.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @arif_tsrm ,
I create a table as you mentioned.
Then I create a measure and here is the DAX code.
Measure =
VAR _Lastest =
CALCULATE ( MAX ( 'Table'[Number] ), ISBLANK ( 'Table'[Attendance] ) )
RETURN
CALCULATE (
MAXX ( FILTER ( 'Table', 'Table'[Number] = _Lastest ), 'Table'[DayShort] ),
ISBLANK ( 'Table'[Attendance] )
)
Now you can use dynamic N-Value (TOPN) for least popular day.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for your reply , you have created the table is data table but my mentioned table is a visualization , I want to calculate the least popular day based on value of the measure [%Of_Attendance_By_DayForM/LPD], if in any days the [%Of_Attendance_By_DayForM/LPD] is blank then those days we not consider . for this data scenerio the least popular day will be Tuesday and Wednesday ( because the lowest value is 50%) instead of Friday.
Hi @arif_tsrm ,
I do some changes on my DAX codes.
Measure 2 =
VAR _A =
MINX (
FILTER ( 'Table', NOT ( ISBLANK ( 'Table'[Attendance] ) ) ),
'Table'[Attendance]
)
RETURN
LOOKUPVALUE ( 'Table'[DayShort], 'Table'[Attendance], _A )
Then you can see that it will return you the smallest value other than blank.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
88 | |
86 | |
68 | |
51 | |
32 |
User | Count |
---|---|
126 | |
112 | |
72 | |
64 | |
46 |