Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a simple chart with dimension Year
and two measures
1:
if(Year=$(v_CY),
sum({<Year={$(v_CY)}, [Quarter Name] = , [Month] = , Date = {"<=$(=Max([Date]))"} >} Volume *[Rate] *Factor) ,
Sum({<Year= ,[Quarter Name] = , [Month] = , Date = {"<=$(=Max([Date]))"} >} Volume*[Rate]))
2:
if( Year=$(v_CY),
Sum({<Year={$(v_CY)} ,[Quarter Name] = , [Month] = , Date = {"<=$(=Max([Date]))"} >} Volume*[Rate]),
if( Year =$(v_PY1),
Sum({<Year={$(v_PY1)} , [Quarter Name] = , [Month] = , Date = {"<=$(=addyears(Max([Date]), -1))"} >} Volume*[Rate]),
if( Year =$(v_PY2),
Sum({<Year={$(v_PY2)} , [Quarter Name] = , [Month] = , Date = {"<=$(=addyears(Max([Date]), -2))"} >} Volume*[Rate]),
)))
so i assume for the three years of data i'd have 6 bars, but i only have current year two bars and previous year 1 bar each.
If i select all three years , 6 bars would all show. But i cant do it as only one year can be selected.
How to show all bars?
thank you!
If always evaluate one condition, u can create multiple expression and apply conditional show based on the selection of year
Try below
MEasure1
if(Year=$(v_CY)
,sum({<Year={">$(=$(v_CY)-2)<=$(v_CY)"},[Quarter Name] = , [Month] = >} Volume *[Rate] *Factor)
,Sum({<Year={">$(=$(v_CY)-2)<=$(v_CY)"},[Quarter Name] = , [Month] = >} Volume*[Rate])
)
MEasure2
Sum({<Year={">$(=$(v_CY)-2)<=$(v_CY)",[Quarter Name] = , [Month] = , Date = {"<=$(=Max([Date]))"} >} Volume*[Rate])
thank you! its a charm.
Sorry i realized that the year 2023 has to be selected, even i used year= in the set analysis, the bars for the 2nd measure still not showing...
what is the variable definition for $(v_CY) ?
MEasure1
if(Year=$(=Max(Yearfield))
,sum({<Year={">$(=Max(Yearfield)-2)<=$(=Max(Yearfield))"},[Quarter Name] = , [Month] = >} Volume *[Rate] *Factor)
,Sum({<Year={">$(=Max(Yearfield)-2)<=$(=Max(Yearfield))"},[Quarter Name] = , [Month] = >} Volume*[Rate])
)
MEasure2
Sum({<Year={">$(=Max(Yearfield)-2)<=$(=Max(Yearfield))"},[Quarter Name] = , [Month] = , Date = {"<=$(=Max([Date]))"} >} Volume*[Rate])