Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I have the following data table
Name | SS | Last4 |
kiki | 111111111 | 1111 |
sisi | 222222222 | 2222 |
tito | 333333333 | 3333 |
|
|
|
And Users Table
User | Role |
|
User1 | ALL |
|
User2 | Station |
|
|
|
|
I need to show a card with SS to all the Roles ALL and show Last4 to the role Station.
Can you help me with that?
Solved! Go to Solution.
Hi @hichamou
To create a card that shows the SS for users with the role "ALL" and the Last4 for users with the role "Station", you can achieve this by creating a measure that uses conditional logic based on the user’s role.
Here’s how you can set it up in DAX, assuming you have relationships between the tables or have set up a way to identify the logged-in user:
Assuming:
Here’s a sample DAX formula:
DisplayValue =
VAR CurrentUser = SELECTEDVALUE('Users Table'[User])
VAR UserRole = LOOKUPVALUE('Users Table'[Role], 'Users Table'[User], CurrentUser)
RETURN
SWITCH(
TRUE(),
UserRole = "ALL", MAX('DataTable'[SS]),
UserRole = "Station", MAX('DataTable'[Last4]),
BLANK()
)
Add the DisplayValue measure to a card visual. Based on the role of the logged-in user, the card will display either the SS or Last4 value.
This setup should dynamically adjust based on the role associated with the user viewing the report. Let me know if you need further assistance!
Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂
Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
YouTube: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
It worked, Thanks Poojara.
@hichamou Glad to hear that!! 🙂
@hichamou Try using below steps
Ensure there is a relationship between the tables if necessary.
Create Measures: Create measures to display the SS or Last4 based on the user's role.
Use DAX for Conditional Display: Use DAX (Data Analysis Expressions) to create measures that conditionally display the SS or Last4 based on the role.
Here is an example of how you can create these measures:
SS_Display =
IF(
SELECTEDVALUE(Users[Role]) = "ALL",
SELECTEDVALUE(DataTable[SS]),
BLANK()
)
Last4_Display =
IF(
SELECTEDVALUE(Users[Role]) = "Station",
SELECTEDVALUE(DataTable[Last4]),
BLANK()
)
Create Cards: Add two card visuals to your report.
Set the Measures: Set the first card to display the SS_Display measure and the second card to display the Last4_Display measure.
Filter the Cards: Ensure that the cards are filtered by the appropriate user role. You can use slicers or filters to control which user role is currently active.
Proud to be a Super User! |
|
Hi @hichamou
To create a card that shows the SS for users with the role "ALL" and the Last4 for users with the role "Station", you can achieve this by creating a measure that uses conditional logic based on the user’s role.
Here’s how you can set it up in DAX, assuming you have relationships between the tables or have set up a way to identify the logged-in user:
Assuming:
Here’s a sample DAX formula:
DisplayValue =
VAR CurrentUser = SELECTEDVALUE('Users Table'[User])
VAR UserRole = LOOKUPVALUE('Users Table'[Role], 'Users Table'[User], CurrentUser)
RETURN
SWITCH(
TRUE(),
UserRole = "ALL", MAX('DataTable'[SS]),
UserRole = "Station", MAX('DataTable'[Last4]),
BLANK()
)
Add the DisplayValue measure to a card visual. Based on the role of the logged-in user, the card will display either the SS or Last4 value.
This setup should dynamically adjust based on the role associated with the user viewing the report. Let me know if you need further assistance!
Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂
Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
YouTube: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |