Forum Discussion
R visual showing two graphs
Hi there,
I have an accumulative chart where I am showing assets and liabilities that are grouped by the axis and my values are 6 different measures. I would need the same graph but showing the results of the previous year. I have seen I could manage to do it using the R visualization but the examples I have found are using a table with the data not measures.
How i could achieve it?
i am not able to provide a data sample.
thanks in advance
2 Replies
- amitchandak
Super User
maserr , The information you have provided is not making the problem clear to me. Can you please explain with an example.
If you looking for last year data or trend you can use time intelligence with date tableExample
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31")) Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31")) This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31")) Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31")) Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31")) Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))Power BI — YTD
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
Appreciate your Kudos.- maserr
Helper IV
Thanks or your reply. My question is how to obtain it in the same graph, p.e. sharing the same legend. I know how to obtain it separately in two graph but this is why i am trying to do it with R.