Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I'm using Field Parameters to allow a user to pick the column they want to see a top 5 in a Clusted Bar Chart.
I created a RankX function with a SWITCH funciton that will allow me to filter the top 5, but it is including blanks in the Field Parameter. How can I exclude the blank from the rankx function? Below is my dax for the measure and a screenshot of what is happening
Stat Area Rank By Res = SWITCH(
TRUE(),
SELECTEDVALUE('Statistical Area'[Statistical Area Fields])="'DimCustomer'[CBSA]",
RANKX(ALLNOBLANKROW(DimCustomer[CBSA]), FactReservation[Reservations],,DESC),
SELECTEDVALUE('Statistical Area'[Statistical Area Fields])="'DimCustomer'[CSA]",
RANKX(ALLNOBLANKROW(DimCustomer[CSA]), FactReservation[Reservations],,DESC),
SELECTEDVALUE('Statistical Area'[Statistical Area Fields])="'DimCustomer'[MSA]",
RANKX(ALLNOBLANKROW(DimCustomer[MSA]), FactReservation[Reservations],,DESC))
I was able to filter the (blank) by adding adding a filter to the visual filters, but I'm afraid when the user changes the field parameter slicer it won't filter out based on the change.
Thank you for these. I tried them both, but I am still getting the blank column in my bar charts. The only way I have been able to filter it out is by adding each of the three DimCustomer fields (MSA, CBSA and CSA) to the visual filter and setting them to 'all except blank.' This appears to work, but I fear that that if there is a result with MSA but CBSA is blank that it is just filtering that result out when MSA is selected in the field parameter slicer even though the MSA is not blank, because the visual is set to filter out blank CBSAs.
Hi @jslade
You may try this
Stat Area Rank By Res =
SWITCH (
TRUE (),
SELECTEDVALUE ( 'Statistical Area'[Statistical Area Fields] ) = "'DimCustomer'[CBSA]",
RANKX (
ALLNOBLANKROW ( DimCustomer[CBSA] ),
CALCULATE (
SUM ( FactReservation[Reservations] ),
FactReservation[CBSA] <> BLANK ()
),
,
DESC
),
SELECTEDVALUE ( 'Statistical Area'[Statistical Area Fields] ) = "'DimCustomer'[CSA]",
RANKX (
ALLNOBLANKROW ( DimCustomer[CSA] ),
CALCULATE (
SUM ( FactReservation[Reservations] ),
FactReservation[CSA] <> BLANK ()
),
DESC
),
SELECTEDVALUE ( 'Statistical Area'[Statistical Area Fields] ) = "'DimCustomer'[MSA]",
RANKX (
ALLNOBLANKROW ( DimCustomer[MSA] ),
CALCULATE (
SUM ( FactReservation[Reservations] ),
FactReservation[MSA] <> BLANK ()
),
DESC
)
)
Or
Stat Area Rank By Res =
SWITCH (
TRUE (),
SELECTEDVALUE ( 'Statistical Area'[Statistical Area Fields] ) = "'DimCustomer'[CBSA]",
RANKX (
FILTER ( ALL ( DimCustomer[CBSA] ), DimCustomer[CBSA] <> BLANK () ),
FactReservation[Reservations],
,
DESC
),
SELECTEDVALUE ( 'Statistical Area'[Statistical Area Fields] ) = "'DimCustomer'[CSA]",
RANKX (
FILTER ( ALL ( DimCustomer[CSA] ), DimCustomer[CSA] <> BLANK () ),
FactReservation[Reservations],
,
DESC
),
SELECTEDVALUE ( 'Statistical Area'[Statistical Area Fields] ) = "'DimCustomer'[MSA]",
RANKX (
FILTER ( ALL ( DimCustomer[MSA] ), DimCustomer[MSA] <> BLANK () ),
FactReservation[Reservations],
,
DESC
)
)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
112 | |
101 | |
94 | |
38 | |
30 |