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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Arjun_reddy
Helper I
Helper I

DAX

Hi Community team,

 

I am facing an issue with the bar chart, I have created one measure when i am using that into bar chart all the data labels are showing same on bars, I don't want see that, I want to see slipted on pack type

Arjun_reddy_0-1692839228249.png

VAR selectedyear=SELECTEDVALUE(Sunchips_MP[YEAR])
VAR MAXPERIOD=MAX(Sunchips_MP[PERIOD])
VAR CY =  CALCULATE(
        SUM('Sunchips_MP'[TOTAL OCCASIONS]),
        FILTER(
            ALL(Sunchips_MP),
            'Sunchips_MP'[YEAR] = SelectedYear && Sunchips_MP[PERIOD] <= MAXPERIOD && Sunchips_MP[BRAND MIX]="SUNCHIPS"
        )
    )

VAR CurrentYear = MAX(Sunchips_MP[YEAR])
VAR PreYear = CurrentYear-1
Var PY = CALCULATE(
        SUM('Sunchips_MP'[TOTAL OCCASIONS]),
        FILTER(
        ALL(Sunchips_MP),
            'Sunchips_MP'[YEAR] = PreYear && Sunchips_MP[PERIOD] <= MAXPERIOD && Sunchips_MP[BRAND MIX]="SUNCHIPS"
        )
    )
VAR YEAR_GROWTHRATE=(CY-PY)/PY
RETURN YEAR_GROWTHRATE
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Arjun_reddy ,

 

I think you create this visual by [Pack] column in X axis and [YoY Growth Rate] in value field.

Your issue should be caused by ALL() function, you need to add [Pack] column into filter field.

Please try code as below.

YOY Growth Rate =
VAR selectedyear =
    SELECTEDVALUE ( Sunchips_MP[YEAR] )
VAR MAXPERIOD =
    MAX ( Sunchips_MP[PERIOD] )
VAR CY =
    CALCULATE (
        SUM ( 'Sunchips_MP'[TOTAL OCCASIONS] ),
        FILTER (
            ALLEXCEPT ( Sunchips_MP, Sunchips_MP[Pack] ),
            'Sunchips_MP'[YEAR] = SelectedYear
                && Sunchips_MP[PERIOD] <= MAXPERIOD
                && Sunchips_MP[BRAND MIX] = "SUNCHIPS"
        )
    )
VAR CurrentYear =
    MAX ( Sunchips_MP[YEAR] )
VAR PreYear = CurrentYear - 1
VAR PY =
    CALCULATE (
        SUM ( 'Sunchips_MP'[TOTAL OCCASIONS] ),
        FILTER (
            ALLEXCEPT ( Sunchips_MP, Sunchips_MP[Pack] ),
            'Sunchips_MP'[YEAR] = PreYear
                && Sunchips_MP[PERIOD] <= MAXPERIOD
                && Sunchips_MP[BRAND MIX] = "SUNCHIPS"
        )
    )
VAR YEAR_GROWTHRATE = ( CY - PY ) / PY
RETURN
    YEAR_GROWTHRATE

 

Best Regards,

Rico Zhou

 

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
Anonymous
Not applicable

Hi @Arjun_reddy ,

 

I think you create this visual by [Pack] column in X axis and [YoY Growth Rate] in value field.

Your issue should be caused by ALL() function, you need to add [Pack] column into filter field.

Please try code as below.

YOY Growth Rate =
VAR selectedyear =
    SELECTEDVALUE ( Sunchips_MP[YEAR] )
VAR MAXPERIOD =
    MAX ( Sunchips_MP[PERIOD] )
VAR CY =
    CALCULATE (
        SUM ( 'Sunchips_MP'[TOTAL OCCASIONS] ),
        FILTER (
            ALLEXCEPT ( Sunchips_MP, Sunchips_MP[Pack] ),
            'Sunchips_MP'[YEAR] = SelectedYear
                && Sunchips_MP[PERIOD] <= MAXPERIOD
                && Sunchips_MP[BRAND MIX] = "SUNCHIPS"
        )
    )
VAR CurrentYear =
    MAX ( Sunchips_MP[YEAR] )
VAR PreYear = CurrentYear - 1
VAR PY =
    CALCULATE (
        SUM ( 'Sunchips_MP'[TOTAL OCCASIONS] ),
        FILTER (
            ALLEXCEPT ( Sunchips_MP, Sunchips_MP[Pack] ),
            'Sunchips_MP'[YEAR] = PreYear
                && Sunchips_MP[PERIOD] <= MAXPERIOD
                && Sunchips_MP[BRAND MIX] = "SUNCHIPS"
        )
    )
VAR YEAR_GROWTHRATE = ( CY - PY ) / PY
RETURN
    YEAR_GROWTHRATE

 

Best Regards,

Rico Zhou

 

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

lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
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.

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

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.