Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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 July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
63 | |
59 | |
56 | |
38 | |
29 |
User | Count |
---|---|
82 | |
62 | |
45 | |
41 | |
40 |