Forum Discussion

abhiram342's avatar
abhiram342
Icon for Microsoft Employee rankMicrosoft Employee
1 year ago
Solved

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 e...
  • BeaBF's avatar
    1 year ago

    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