Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
abhiram342
Microsoft Employee
Microsoft Employee

Dynamically change measure/column based on toggle button or slicer

Hi Team - I created a Direct Lake model based on the Lakehouse SQL endpoint, and one of the tables contains two URL columns. We need to display the URL column in a table chart, dynamically showing either URL1 or URL2 based on the tenant name.

If a user opens the report in Tenant "A," it should display URL1.
If a user opens the report in Tenant "B," it should display URL2.
By default, the URL should be URL1.
I researched possible solutions and found the following approaches:

Tenant Selection Table – Create a table in Direct Lake with tenant names (Tenant A & Tenant B) and use a measure to switch between URL1 and URL2 based on the selected tenant in a slicer.
Toggle Button – Use a toggle button to switch between Tenant A & Tenant B, defaulting to URL1 unless another option is selected.
Is there a way to achieve this behavior without creating a table in Direct Lake? I noticed that calculated tables are not supported in Direct Lake.
 
Thanks,
Abhiram
1 REPLY 1
BeaBF
Super User
Super User

@abhiram342 Hi! Yes, you can achieve this behavior without creating a separate table in Direct Lake by leveraging DAX measures and dynamic filtering. 

Create a measure in Power BI that dynamically switches URLs based on the user's tenant:
SelectedURL =
VAR CurrentTenant = LOOKUPVALUE(TenantTable[TenantName], TenantTable[UserEmail], USERPRINCIPALNAME())
RETURN
IF(CurrentTenant = "Tenant B", SELECTEDVALUE(Table[URL2]), SELECTEDVALUE(Table[URL1]))

 

Use the measure in your table visual.

 

BBF

Helpful resources

Announcements