Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
I have a card which shows page views for each user and another card which shows whether the page views are above or below average. I only want this card (Above/Below Average) to display when a user is selected. The default is when no user is selected, the total sum of page views displays and then it says Above Average, the issue with that is that the sum of page views is always going to be larger than the average so therefore it will always show Above Average. Is there any way to have cards only display when a value is selected?
Hi @totamum ,
If you need to ensure that exactly one user is selected, you can use HASONEVALUE function:
AboveBelowAvg =
IF(
HASONEVALUE(Users[UserID]), // Check if exactly one user is selected
[Your measure used to calculate bellow and above],
BLANK()
)
Or you can check if the UserID column is being filtered ( with one or multiple user's):
AboveBelowAvg =
IF(
ISFILTERED(Users[UserID]), // Check if there's any filter on the UserID column
[Your measure used to calculate bellow and above],
BLANK() // Return blank when no filter is applied (i.e. no user is selected)
)
Thanks no I'd just like to not have a value display when nothing is selected. I tried the second one but it says Blank even when users are selected.
I did try the solution you provided but it didn't work. This one did except I'd rather it be null than say blank so I've saved this measure.
Hi @totamum
Please, for acurate solution, consider to share the measures used in both scenarios, for page views and for above and bellow.
Solution 1: DAX for Visibility Management
To limit the card being shown, you will need to create a measure that returns a value only when a user is selected, otherwise a blank value is returned.
Step 1: To Create a Measure
DAX
Edit Copy
AboveBelowAverage =
VAR SelectedUser = SELECTEDVALUE(‘Users’[User])
VAR UserPageViews = SUM(‘PageViews’[Views])
VAR AvgPageViews = AVERAGE(‘PageViews’[Views])
RETURN
IF(
ISBLANK(SelectedUser),
BLANK(), – Hide when no user is selected
IF(UserPageViews > AvgPageViews, “Above Average”, “Below Average”)
)
Step 2: Make This Card Measure Active
Using Power Bi Card visual’s field function, take out the current field and replace it with this measure.
Above/Below Average card, will usually not display when no user is selected as Power BI card visuals automatically hide blank values.
Solution 2: Apply a Visual Level Filter
Another option is applying a visual level filter to the card.
Click the Above/Below Average card.
Go to Filters pane and on filter type select ‘Users’[User] field.
Filter to is not blank.
This ensures that the card only shows up when a user is selected.
Thank you, solution 1 worked except it actually says Blank and I'd rather it not have anything, how can it literally be blank?
Once user is selected
Hi @totamum ,
try this:
Show Above/Below Average =
IF (
ISFILTERED ( Users[User] ), -- Checks if a user is selected
[Above Below Average Measure], -- Displays your existing measure when a user is selected
BLANK() -- Returns blank when no user is selected
)
Please mark this as solution if it helps you. Appreciate Kudos.
It says Blank and doesn't change when a user is selected
User | Count |
---|---|
65 | |
60 | |
47 | |
33 | |
32 |
User | Count |
---|---|
86 | |
75 | |
56 | |
50 | |
45 |