Forum Discussion

brittanyruffin's avatar
2 years ago

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

 

Chart with legend:

 

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