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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply

Disabling buttons for conditions.

I have a parameter measure in Power BI that has a DAX formula of the following:

 

Parameter = {
("Products sold", NAMEOF(Invoice['ProductsSold']), 0),
("Profit", NAMEOF(Invoice[ProfitMade]), 1),
("Losses", NAMEOF(Invoice[LossesLost]), 2)
}

 

I also have the following, being used in a button slicer:

 

Parmeter_Title =
SWITCH(
TRUE(),
Parameter[Parameter]="Products sold","PRODUCTS SOLD",
Parameter[Parameter]="Profit","PROFIT MADE",
Parameter[Parameter]="Losses","MONEY LOST"
)

 

I want to edit the functions so that Profit and Losses are only accessible when the column hierarchy[data_source] equals either "company1", "company2" or "company3", and that otherwise the buttons are disabled and only Products Sold is viewable.

One thing to mention is that I want to try this on multiple datasets for companies. However, only the datasets for companies 1, 2 and 3 should have the buttons accessible (the column hierarchy[data_source] consists of only "company[a]" and "demo).

1 ACCEPTED SOLUTION

Don't worry about it. I already fixed it myself.

 

However, I do have another issue that I shall post to the forums.

View solution in original post

7 REPLIES 7
v-sshirivolu
Community Support
Community Support

Hi @RichardLinderma ,
Thank you for reaching out to Microsoft fabric community.

Try these steps - 

Create a Disconnected Parameter Table

Parameter = DATATABLE(
"Label", STRING,
{
{"Products sold"},
{"Profit"},
{"Losses"}
}
)

Create a Data Source Allowed Logic Measure
IsCompanyAllowed =
IF (
SELECTEDVALUE('hierarchy'[data_source]) IN {"company1", "company2", "company3"},
1,
0
)

Create a Dynamic Title Measure
Parameter_Title =
VAR SelectedParam = SELECTEDVALUE('Parameter'[Label])
VAR IsAllowed = SELECTEDVALUE('hierarchy'[data_source]) IN {"company1", "company2", "company3"}
RETURN
SWITCH(
    TRUE(),
    SelectedParam = "Products sold", "PRODUCTS SOLD",
    SelectedParam = "Profit" && IsAllowed, "PROFIT MADE",
    SelectedParam = "Losses" && IsAllowed, "MONEY LOST",
    BLANK()
)

Create a Button Visibility Measure
IsButtonVisible =
VAR SelectedParam = SELECTEDVALUE('Parameter'[Label])
VAR IsAllowed = SELECTEDVALUE('Invoice'[data_source]) IN {"company1", "company2", "company3"}
RETURN
SWITCH(
    TRUE(),
    SelectedParam = "Products sold", 1,
    SelectedParam IN {"Profit", "Losses"} && IsAllowed, 1,
    0
)

Create Two Versions of Each Button
For each metric, set up:

  • ON Button (visible for allowed companies)
  • OFF Button (grayed out or with a "Not available" tooltip)

Name these in the selection pane as:

  • Profit Button ON / OFF
  • Losses Button ON / OFF
  • Products Sold Button ON / OFF (optional)


Stack Buttons Over Each Other

  • Place ON and OFF versions in the same position
  • Use the Selection Pane to manage and name them
  • Control visibility with conditions

Create Bookmarks to Show/Hide the Correct Buttons
Bookmark 1 – Allowed Companies
Show ON buttons for Profit and Losses, hide OFF buttons. Save as: Allowed Companies
Bookmark 2 – Other Companies
Show OFF buttons, hide ON versions. Save as: Other Companies
Be sure to turn off the "Data" option in bookmark settings.

Assign Buttons to Toggle Bookmarks
Add shapes or slicer buttons for Allowed Companies and Other Companies. These will control which button set is visible.
Test the Setup
Select a company using the slicer and verify that the correct buttons appear accordingly.


Find the attached .pbix file for your reference

I REALLY need a response to this. It's urgent.

Hi @RichardLinderma,

 

Apologies for the delayed response.

I am currently looking into your issue as a priority and will update you as soon as possible.

Thank you for your Patience.

Don't worry about it. I already fixed it myself.

 

However, I do have another issue that I shall post to the forums.

Hi @RichardLinderma ,

If the other issue is related to this question, feel free to ask here. Otherwise, please close this thread and post your new issue in a separate one. Thanks

Hi @RichardLinderma ,

If your other issue is related to this question, you can ask it here. If not, please close this thread and start a new one for your separate issue. Thank you.

 

Hi @RichardLinderma ,
If your question is connected to your previous issue, you can ask it here. Otherwise, please close this thread and start a new one for any different concerns. Thank you

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors