Forum Discussion
Datesbetween - Line Chart Visualisation
- Anonymous8 years ago
CNH,
Please check the following PBIX file.
https://1drv.ms/u/s!AhsotbnGu1NokzPRuVppwzju4CmB
Regards,
Lydia
Phil, thanks for that I will work on this tomorrow and see whether I can get what I am after.
Hi Phil, I have had a bit of a look and I am lost.
Can I use the following as an example:
Raw data, in table "Transactions"
| Date | Revenue |
| 1/01/2016 | 10 |
| 2/01/2016 | 15 |
| 3/01/2016 | 20 |
| 4/01/2016 | 10 |
| 5/01/2016 | 11 |
| 6/01/2016 | 15 |
| 7/01/2016 | 20 |
| 8/01/2016 | 5 |
| 1/01/2017 | 10 |
| 2/01/2017 | 10 |
| 3/01/2017 | 14 |
| 4/01/2017 | 13 |
| 5/01/2017 | 18 |
| 6/01/2017 | 20 |
| 7/01/2017 | 25 |
| 1/01/2018 | 4 |
| 2/01/2018 | 17 |
| 3/01/2018 | 16 |
| 4/01/2018 | 14 |
| 5/01/2018 | 23 |
| 6/01/2018 | 10 |
What code would you use to create a measure to sum YTD. I have been using the following code to calculate YTD Revenue in
YTD Revenue = CALCULATE(Transactions[Revenue], DATESBETWEEN('Dates'[Date], BLANK(), LASTDATE('Dates'[Date])))
I can use the following code to set the fiscal year
Fiscal Year = if(MONTH([DATE]) > 6, YEAR([DATE])+1, YEAR([DATE]))
In theory I end up with:
| Date | Revenue | Ytd Revenue | Fiscal Year |
| 1/01/2016 | 10 | 10 | 2016 |
| 2/01/2016 | 15 | 25 | 2016 |
| 3/01/2016 | 20 | 45 | 2016 |
| 4/01/2016 | 10 | 55 | 2016 |
| 5/01/2016 | 11 | 66 | 2016 |
| 6/01/2016 | 15 | 81 | 2016 |
| 7/01/2016 | 20 | 101 | 2016 |
| 8/01/2016 | 5 | 106 | 2016 |
| 1/01/2017 | 10 | 10 | 2017 |
| 2/01/2017 | 10 | 20 | 2017 |
| 3/01/2017 | 14 | 34 | 2017 |
| 4/01/2017 | 13 | 47 | 2017 |
| 5/01/2017 | 18 | 65 | 2017 |
| 6/01/2017 | 20 | 85 | 2017 |
| 7/01/2017 | 25 | 110 | 2017 |
| 1/01/2018 | 4 | 4 | 2018 |
| 2/01/2018 | 17 | 21 | 2018 |
| 3/01/2018 | 16 | 37 | 2018 |
| 4/01/2018 | 14 | 51 | 2018 |
| 5/01/2018 | 23 | 74 | 2018 |
| 6/01/2018 | 10 | 84 | 2018 |
With this data I would then be able to plot revenue as I am after, using Fiscal Year as the Legend, YTD Revenue as the values against the Date axis.
That is the theory I am trying to execute, but I do not know how.
My apologies for being so daft, but I do not know how to proceed.
Thanks if you or someone else can help me.
- Anonymous8 years agoNot applicable
CNH,
Please check the following PBIX file.
https://1drv.ms/u/s!AhsotbnGu1NokzPRuVppwzju4CmB
Regards,
Lydia - CNH8 years agoHelper I
Hi Lydia,
Thanks for that. I've used
YTD Revenue = TOTALYTD(SUM(Transactions[Revenue]),Dates[Date],"30 06 2018")
This has in fact achieved what I was after.
Thanks to everyones input.
- CNH8 years agoHelper I
Lydia,
Could I add to this question. Having plotted actual revenue I would like to also plot 2 targets, Target 1 and Traget 2.
For year 1, Target 1 lets say is 100,000 and target 2 is 120,000.
For year 2, Target 1 lets say is 105,000 and target 2 is 130,000.
For year 3, Target 1 lets say is 110,000 and target 2 is 140,000.
I would like these to plot in a ray for each fiscal year, ie year 1 Target 1 rises from zero to 100,000 over the year time line etc
Is there a measure that I could write in Power BI to provide the data to populate.
Alternatively the data for my revenue is coming from an excel spreadsheet - I could easily introduce a new worksheet "Target" which has the three year dates populated and either daily or an accumulating total for Target 1 and Target 2.
Hopefully you can assist here. I have tried to do the excel spreadsheet worksheet but it hasn't worked.
Thanking you