Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We need to create a bar chart for years and months . Condition if we select 2012 year data and Aug month then bar chart reflect 2012 year data and previous year 2011 but bar should be from Jan to Aug for both year. Use only set Analysis.
How to do this?
I take it that you want to compare the current and the same period last year's data based on user selection. dimensions.
In such a case, perhaps these
Current Period
SUM({$<Date = {"$(='>=' & Date(YearStart(Max([Date Field])), 'DD/MM/YYYY') & '<=' & Date(Max([Date Field]), 'DD/MM/YYYY'))"}>}Yourmeasure)
Same period Last Year
SUM({$<Date={">=$(=YearStart(Max([Date Field]), -1))<=$(=AddYears(Max([Date Field]), -1))"}>}Yourmeasure)
Hi Peter, Yes i need to create comparison chart. but how to use both set analysis in one measure.
There are two ways you can get this done
1) 1 Dimension 2 Measures
Dimension: YearMonth field (eg values '2022-Jan','2022-Feb')
Measure 1: Current Year
sum({<Datefield={">=$(=Date(Yearstart(Max(Datefield)),'YYYY-MM-DD'))<=$(=Date(Max(Datefield),'YYYY-MM-DD'))"}>}SomeMeasure)
Measure 2: Previous Year
sum({<Datefield={">=$(=Date(Yearstart(Max(Datefield),-1),'YYYY-MM-DD'))<=$(=Date(Addyears(Max(Datefield),-1),'YYYY-MM-DD'))"}>}SomeMeasure)
2) 2 Dimensions 1 Measure
Create a new field say "MonthNum" that has numeric values for Jan,Feb,Mar as 1,2,3..12
Then in chart use below
Dimension1: Year
Dimension2: Month
Measure 1:
sum({<Year={"$(=Max(Year)),$(=Max(Year)-1)"}
,MonthNum={"<=$(Max(MonthNum))"}
,Month=
>}SomeMeasure)