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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply

Bar Chart Legend Field Not Working with SWITCH formula

I have the below chart that has a SWITCH formula for the values. I created this so that the filters would function correctly and give the proper results. The formula works as planned, however I am needing to put a legend on the chart for a category. When I put anything in the legend, it just stacks the 2 values on top if the category is split (example below). How can I get it to work properly?

 

Chart without legend

brittanyruffin_0-1707771631915.png

 

Chart with legend:

brittanyruffin_1-1707771667692.png

 

Formula:

DynamicMetric =
SWITCH (
    TRUE (),
    ISFILTERED('Basic Info REIT'[Shopping Center Name]),
        [Property % of ABR],
       
    ISFILTERED('Basic Info REIT'[Leasing Agent]),
        [Leasing Agent % of ABR],

    ISFILTERED('Basic Info REIT'[Region]),
        [Region % of ABR],  

     ISFILTERED('Basic Info REIT'[Division]),
        [Division % of ABR],

     ISFILTERED('Basic Info REIT'[Market Officer]),
        [Market Officer % of ABR],
       
    NOT(ISFILTERED('Basic Info REIT'[Shopping Center Name]) || ISFILTERED('Basic Info REIT'[Leasing Agent]) || ISFILTERED('Basic Info REIT'[Market Officer]) || ISFILTERED('Basic Info REIT'[Region]) || ISFILTERED('Basic Info REIT'[Division])),
        [Property % of ABR],
       
BLANK() )
 
Example of ABR formula:
Division % of ABR =
VAR Base = SUM('Basic Info REIT'[Annual Base Rent])
VAR TotalBase = SUMX(DISTINCT('Basic Info REIT'[Total Division Rent]), 'Basic Info REIT'[Total Division Rent])
RETURN
    DIVIDE(Base, TotalBase, BLANK()
    )

 

 

3 REPLIES 3
lbendlin
Super User
Super User

Please define "Properly".  What is your expected result?

I want to know the break up of each category. and for it to be in the correct order. my legend is to show if each category is in the health & wellness bucket or not (light blue for no, dark blue for yes). for example, Professional Services - i want to know of the 8.8% whats the breakdown of the 8.8% that is health and wellness or not health and wellness. hopefully this makes sense. 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.