Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a table like Salesdate,product_id,Total. I added a KPI and want to show Selected Years Sales and and previous years sales.
I added a field tom my sheet to select the year.(salesdate.year).
What should be in expression of the kpi data.
Regards.
Create Field like
Load Salesdate,
product_id,
Total,
Year(Salesdate) as salesdate.year
From Table;
Then, Measure looks like this?
='Current Year ' & Sum({<salesdate.year = {'$(=Max(salesdate.year))'}>} Total) & Chr(10) & 'Previous Year ' & Sum({<salesdate.year = {'$(=Max(salesdate.year-1))'}>} Total)
I have created a filed in Sales table like year which is the year of the sales_date.
I have 2 KPI's now. both have different measurment. but the results are the same.
Results are the same.
The solution that provided by Anil is correct, with the observation that the correct expression is:
='Current Year ' & Sum({<salesdate.year = {'$(=Max(salesdate.year))'}>} Total) & Chr(10) & 'Previous Year ' & Sum({<salesdate.year = {'$(=Max(salesdate.year)-1)'}>} Total)
Still the same result. I'm selecting the year from the field I added to my sheet which is Saledate.year. Is there something wrong with it? Logically this expression should work but it's n ot
Hi,
Create these variables:
vCurrentYear = Max(Year)
vPreviousYear = Max(Year-1)
vCurrentTotal = Sum({<Year={$(vCurrentYear)}>}Total)
vPreviousTotal = Sum({<Year={$(vPreviousYear)}>}Total)
I hope this solve your problem