Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I am trying to count Last 3 Months Identical Sales, and using below expression, but its not returning any thing.
Could you please advise me about this?
=Count(If(
floor(Sum({$<Year=, Month=, [Year Month]={">=$(=Date(MonthStart(AddMonths(Min(SaleDate),0)),'YYYYMM'))<=$(=Date(MonthStart(AddMonths(Max(SaleDate),0)),'YYYYMM'))"}>} Sale))>0
And
floor(Sum({$<Year=, Month=, [Year Month]={">=$(=Date(MonthStart(AddMonths(Min(SaleDate),0)),'YYYYMM'))<=$(=Date(MonthStart(AddMonths(Max(SaleDate),0)),'YYYYMM'))"}>} Sale))
=
floor(Sum({$<Year=, Month=, [Year Month]={">=$(=Date(MonthStart(AddMonths(Min(SaleDate),-1)),'YYYYMM'))<=$(=Date(MonthStart(AddMonths(Max(SaleDate),-1)),'YYYYMM'))"}>} Sale))
And
floor(Sum({$<Year=, Month=, [Year Month]={">=$(=Date(MonthStart(AddMonths(Min(SaleDate),0)),'YYYYMM'))<=$(=Date(MonthStart(AddMonths(Max(SaleDate),0)),'YYYYMM'))"}>} Sale))
=
floor(Sum({$<Year=, Month=, [Year Month]={">=$(=Date(MonthStart(AddMonths(Min(SaleDate),-2)),'YYYYMM'))<=$(=Date(MonthStart(AddMonths(Max(SaleDate),-2)),'YYYYMM'))"}>} Sale))
,1))
Kind regards,
Farrukh
You would need to Add Aggr between Count and if and use your dimensions
You would need to Add Aggr between Count and if and use your dimensions
Can u please share sample data along with output .
It would better i guess
-Nagarjun
Thanks Sunny.
Hi Sunny,
Can you please see the attached sample data, as per your advised I used the dimension with Aggr function and it was working but due to some reason its just returning zero values.
I am trying to count Last Three month Identical sale. By displaying MonthYear Dimension for last 7 months.
Can you please advise me about this?
Kind regards,
Farrukh
Your YearMonth field is not read as date here. It seems to be read as a text or number... Try this in the script:
LOAD SaleDate,
Date(MonthStart(Date#(YearMonth, 'YYYYMM')), 'YYYYMM') as YearMonth,
Region,
CityCode,
ProCode,
District,
Sale
FROM
(ooxml, embedded labels);
$(Include=F:\TestChartCalendar2.txt);
Thanks Sunny,
I change the format in excel file and its sorted.
As you can see the I have a count of identical sale of last three month and Current month is selected Sep Year is 2016.
Could you please advise me how to display count of last 6 months.
Aug-2016
Jul-2016
Jun-2016
May be this:
=Count({$<Year=, Month=, YearMonth={">=$(=Date(MonthStart(AddMonths(Min(SaleDate),0)),'YYYYMM'))<=$(=Date(MonthStart(AddMonths(Max(SaleDate),-2)),'YYYYMM'))"}>} Aggr(If(
floor(Sum({$<Year=, Month=, YearMonth={">=$(=Date(MonthStart(AddMonths(Min(SaleDate),0)),'YYYYMM'))<=$(=Date(MonthStart(AddMonths(Max(SaleDate),0)),'YYYYMM'))"}>} Sale))>0
And
floor(Sum({$<Year=, Month=, YearMonth={">=$(=Date(MonthStart(AddMonths(Min(SaleDate),0)),'YYYYMM'))<=$(=Date(MonthStart(AddMonths(Max(SaleDate),0)),'YYYYMM'))"}>} Sale))
=
floor(Sum({$<Year=, Month=, YearMonth={">=$(=Date(MonthStart(AddMonths(Min(SaleDate),-1)),'YYYYMM'))<=$(=Date(MonthStart(AddMonths(Max(SaleDate),-1)),'YYYYMM'))"}>} Sale))
And
floor(Sum({$<Year=, Month=, YearMonth={">=$(=Date(MonthStart(AddMonths(Min(SaleDate),0)),'YYYYMM'))<=$(=Date(MonthStart(AddMonths(Max(SaleDate),0)),'YYYYMM'))"}>} Sale))
=
floor(Sum({$<Year=, Month=, YearMonth={">=$(=Date(MonthStart(AddMonths(Min(SaleDate),-2)),'YYYYMM'))<=$(=Date(MonthStart(AddMonths(Max(SaleDate),-2)),'YYYYMM'))"}>} Sale))
, 1), Region, CityCode, ProCode, District))
Hi Sunny,
Its returning a count just for one month, and other two months count are zero.
Farrukh
Not sure what you required output is, but isn't this what you want?