The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello everyone,
I am looking for a TotalYTD() function with a start date and an end date.
I tried with a Flag_Start_Date with some If but I wasn't able to find the answer.
The Start date should be always "01/09"
And the End date should be the last date (DD/MM) of data.
For example If I have some data from 01/01/2015 to 01/02/2017 (DD/MM/YYYY format)
I want be build a table visualization like this :
Year | Qtr | Sum Sales | YTD Sales fiscal |
2015 | 1 | 10 | 10 |
2015 | 2 | 10 | |
2015 | 3 | 10 | 10 |
2015 | 4 | 10 | 20 |
2016 | 1 | 20 | 40 |
2016 | 2 | 20 | |
2016 | 3 | 20 | 20 |
2016 | 4 | 20 | 40 |
2017 | 1 | 30 | 70 |
2017 | 2 | 30 | |
2017 | 3 | 30 | 30 |
2017 | 4 | 30 | 60 |
I don't add Month column to not have to many rows in my table.
Is it possible ?
Thank you for your help,
Regards,
Lovebo
Hello Stachu,
Yes of course :
Year | Qtr | Month | Sales |
2015 | 3 | 7 | 10 |
2015 | 3 | 8 | 10 |
2015 | 3 | 9 | 10 |
2015 | 4 | 10 | 10 |
2015 | 4 | 11 | 10 |
2015 | 4 | 12 | 10 |
2016 | 1 | 1 | 20 |
2016 | 1 | 2 | 20 |
2016 | 1 | 3 | 20 |
2016 | 2 | 4 | 20 |
2016 | 2 | 5 | 20 |
2016 | 2 | 6 | 20 |
2016 | 3 | 7 | 20 |
2016 | 3 | 8 | 20 |
2016 | 3 | 9 | 20 |
2016 | 4 | 10 | 20 |
2016 | 4 | 11 | 20 |
2016 | 4 | 12 | 20 |
2017 | 1 | 1 | 30 |
2017 | 1 | 2 | 30 |
I cannot reconcile numbers with your example - can you check the attached file?
I added Date column to the table with data, as well as Calendar table so we can make use of the time intelligence functions.
Then I added the following measure
Measure = CALCULATE(SUM('Table'[Sales]),DATESYTD('Calendar'[Date],"31/08"))
It works as I would expect with this data, but the results don't seem to be consistent with your expected output - does the input match the output you posted in the first post?
Hello Stachu,
Thank you for your answer, in fact I need to add a start date and an end date. With the classic DatesYTD() or TotalYTD() functions we can only add an end date which is also the start date (D+1) in fact.
So for example my start date should be 1st february (01/02/2015) and me end date 31st August (31/08/2017).
So with the data that I sent, we should have this result :
Thank you again for your help,
Lovebo
Can you add sample input tables (in format that can be copied to PowerBI) from your model with anonymised data? Like this (just copy and paste into the post window).
Column1 | Column2 |
A | 1 |
B | 2.5 |
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
20 | |
19 | |
18 | |
13 |
User | Count |
---|---|
41 | |
38 | |
24 | |
22 | |
20 |