Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Everyone
Pls help me in CY Vs PY logic.
want to show CY Vs PY Sales.
Consider you have below script..
================
Sales:
Load * Inline
[
Customer, Sales, Year
A, 100, 2012
A, 120, 2013
B, 90, 2012
B, 110, 2013
C, 150, 2012
C, 110, 2013
];
===========================
You can show CY vs LY/PY sales growth as below
Create a Straight Table
Dimension
Customer
Expressions
2012 Sales
SUM({<Year = {2012}>}Sales)
2013 Sales
SUM({<Year = {2013}>}Sales)
Growth
SUM({<Year = {2013}>}Sales)/SUM({<Year = {2012}>}Sales)-1
Don't forget to change Number formatting of Growth to percentage from Properties = Number Tab
Instead of hardcoding 2012,2013.. values, create a variable vMaxYr = Max(Year()).
for PY you can use vMaxYr-1
You can create variable or by the use of the SET analysis you can create the expressions for Current Yr vs Previous Yr sales. But all ready explain by the member is right.
Current Year Sales
=Sum({<Year = {'$(=Max(Year))'}>} Sales)
Or
By Formula use
=Sum({<Year = {"$(vCurrYr)"}>} Sales)
Previous Year Sales
=Sum({<Year = {'$(=Max(Year)-1)'}>} Sales)
Or
By Formula Use
=Sum({<Year = {"$(vPrevYr)"}>} Sales)
if i am using above expression i am using same values for both current year and previous year
You have to by pass the other fields as well and did you create the correct variables because it is demo code.
Hi
i want to compare sales for current and previous year but i am getting same values for all. pease help
so for that i have declared
current year
curr_year = Max(sold_Year)
previous year
prev_year=max(sold_year)-1
for expression for current year
=num(sum({<sold_year = {"$(curr_year)"}>}[inv value])/(Sales_INR_Unit),'#,##0.0')
for expression for previous_year
=num(sum({< sold_Year = {"$(=$(prev_year))"}>}
[inv value]/Sales_INR_Unit),'#,##0.0')
for total growth
=num(
sum({<sold_year = {"$(curr_year)"}>}[inv value])
-
sum({< sold_Year = {"$(=$(prev_year))"}>}
[inv value])
/
sum({< sold_Year = {"$(=$(prev_year))"}>}
Did you check because i am getting different values
Please check the snap shot
Sir
please help
i have to replace year with my column name ie sold_year
so now expression will be
sum({sold_year={'$(max(sold_year))'}>} inv_value)
correct?
Check on this thread please for your answers.