Forum Discussion
Arjun_reddy
2 years agoHelper 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 w...
- Anonymous2 years ago
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_GROWTHRATEBest Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
2 years agoNot 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.