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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
filipe197
Frequent Visitor

How to use button to modify measure

Hello,

I want to set a measure (i will call it Rate) but i wanna somehow link it to a button that could consider or not one of the parcels (or set it to zero). In the example below the measure is the formula for "Rate" ant the button would consider or not the parcel of Manual movements according the user will. Hou can i do this??

Rate = (Costs + Manual movements)/Income

Customer Costs Manual Movements Income
1 10 2 50
2 20 5 70
3. 30 10 100
Sum. 60 17 220

Button YES - considering manual movements
NO - Not considering manual movements

Result:

Yes - =(60+17)/220
No - =60/220
1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi @filipe197,

 

There is a slicer visual in Power BI rather than a button. You can try it in this file.

1. An independent table Buttons.

Yes

No

2. A measure.

Result =
IF (
    HASONEVALUE ( Buttons[Button] ),
    IF (
        VALUES ( Buttons[Button] ) = "Yes",
        DIVIDE (
            SUMX ( 'Table1', 'Table1'[Costs] + Table1[Manual Movements] ),
            SUM ( Table1[Income] ),
            0
        ),
        DIVIDE ( SUM ( Table1[Costs] ), SUM ( Table1[Income] ), 0 )
    ),
    BLANK ()
)

How_to_use_button_to_modify_measure

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-jiascu-msft
Employee
Employee

Hi @filipe197,

 

There is a slicer visual in Power BI rather than a button. You can try it in this file.

1. An independent table Buttons.

Yes

No

2. A measure.

Result =
IF (
    HASONEVALUE ( Buttons[Button] ),
    IF (
        VALUES ( Buttons[Button] ) = "Yes",
        DIVIDE (
            SUMX ( 'Table1', 'Table1'[Costs] + Table1[Manual Movements] ),
            SUM ( Table1[Income] ),
            0
        ),
        DIVIDE ( SUM ( Table1[Costs] ), SUM ( Table1[Income] ), 0 )
    ),
    BLANK ()
)

How_to_use_button_to_modify_measure

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-jiascu-msftyou rule !! It has worked!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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