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
DaurenDC
Frequent Visitor

% of Total is not working with parameter

Hi, Power BI community!
 
I have a Power BI dashboard with a group of Bar charts with dynamic field in the legend (there are two values) and I have a measure which calculates the % of total for this charts (this parameter in legend is not used in the calculations)
Here is the measure:
% of Total by Market = DIVIDE([Revenue Exchanged], CALCULATE([Revenue Exchanged], ALLEXCEPT(Table1, Table1[market])),0)
 
The problem is, when I switch the legend parameter, this calculation stops working, so it works only with the first value, but shows 100% for everything when parameter value is changed, could someone help with that?
 
Here is the parameter:
Bar charts parameter = {
("Group1", NAMEOF('Table1'[field1]), 0),
("Group2", NAMEOF('Table2'[field2]), 1)
}
 
Thanks in advance!
1 ACCEPTED SOLUTION
DaurenDC
Frequent Visitor

Hi Everyone, I found a solution to this:

% of Total by Market =
IF
(SELECTEDVALUE('Parameter name'[Parameter Fields]) = "'table1'[field1]",
DIVIDE([Revenue Exchanged c], CALCULATE([Revenue Exchanged c], ALLEXCEPT(table1, table1[market]))),
DIVIDE([Revenue Exchanged],CALCULATE([Revenue Exchanged],ALLEXCEPT(table2,table2[market]))))

Working with parameters can be tough sometimes

View solution in original post

2 REPLIES 2
DaurenDC
Frequent Visitor

Hi Everyone, I found a solution to this:

% of Total by Market =
IF
(SELECTEDVALUE('Parameter name'[Parameter Fields]) = "'table1'[field1]",
DIVIDE([Revenue Exchanged c], CALCULATE([Revenue Exchanged c], ALLEXCEPT(table1, table1[market]))),
DIVIDE([Revenue Exchanged],CALCULATE([Revenue Exchanged],ALLEXCEPT(table2,table2[market]))))

Working with parameters can be tough sometimes
v-shex-msft
Community Support
Community Support

Hi @DaurenDC ,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.