Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone !
I am contacting you to request your assistance.
I would like to create a line chart
which calculates delta between N and N-1 (years, semester, quarter, month, days).
I made an hierarchy for that.
The blocking point is that the calculation must always select the last date of the selected period.
For example:
If I'm on a view per month,
I would calculate 31/01/2010 - 31/01/2019 and the same for all months.
Thanks a lot
with the attached version, I think we have the same values.
The alternative is to calculate it in script and then apply it in measure
S:
=if(isnull(Max({$<YEAR={$(=Max(YEAR))}>} S_CONTRACT_COUNT)),0,Max({$<YEAR={$(=Max(YEAR))}>} S_CONTRACT_COUNT))
-if(isnull(Max({$<YEAR={$(=Max(YEAR)-1)}>} S_CONTRACT_COUNT)),0,Max({$<YEAR={$(=Max(YEAR)-1)}>} S_CONTRACT_COUNT))
T:
=if(isnull(Max({$<YEAR={$(=Max(YEAR))}>} T_CONTRACT_COUNT)),0,Max({$<YEAR={$(=Max(YEAR))}>} T_CONTRACT_COUNT))
-if(isnull(Max({$<YEAR={$(=Max(YEAR)-1)}>} T_CONTRACT_COUNT)),0,Max({$<YEAR={$(=Max(YEAR)-1)}>} T_CONTRACT_COUNT))
can you share a sample data and the expected output
Hi @Taoufiq_Zarra .
Here is an example of data.
There are dates informations, an other dimension CITY, and a measure NB.
I would like to make a line chart visualization which calculate delta between Year N and Year N-1 for all date element (delta = Measure N - Measure N-1)
I have to do calculation with last dat eof each periode.
In the picture, there is a filter (green) named "Dimensions".
I have to be able to display my measure by fo example CITY (or another dim).
Thanks a lot
Best Regards,
Harry
Bonjour @marakud971
You can add for example {$<Year={"$(=Max(Year))"}>} for Year and {$<Year={"$(=Max(Year)-1)"}>} for YEAR-1
I can't suggest the exact script since I haven't understood what you want to do yet.
Can you give more detail or ana example.
Merci pour ton retour
Hi @Taoufiq_Zarra ,
sorry, i will give you more explanations.
For example :
if in my visualization, i've got a hierachy Year-> Semester->Quarter-Month->Week->Day
I have to find the last date of each period when i calculate the difference.
In a second part,
i have to aggregate this measure if i would like to display a dim values in my chart.
Is my need clearer ?
Thanks @Taoufiq_Zarra
If I understand correctly, you always compare the max year (or the selected year) with the year -1.
so I think you just need :
=Max({$<Année={"$(=Max(Année))"}>} CONTRACT_COUNT)-Max({$<Année={"$(=Max(Année)-1)"}>} CONTRACT_COUNT)
in the other levels if you select, month, semester, ..., the same formula will work, since it will compare the selected month, semester,... of the year with year-1.
attached qvw file
Don't hesitate if you have any other remarks.
thanks @Taoufiq_Zarra .
I tried your solution. It works well in a textbox. Thanks !
But how to adapt this measure in a line chart ?
When i try, my visualisazion stay blank.
Thanks again.
@marakud971 how you conceived the line chart, what do you expect for the x-axis and y?
I updated my data file.
you'll find in attachment
You'll also find a picture in this xls file.
Regards,
Harry
@marakud971 I'm sorry, but I still can't fully understand the need ?
are the values is Max year-(Max year-1)?
can you give me a simple example to understand:
I want to display the XXXX values for T1 for MArtinique as an example?
attached the version