Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

YTD Running Total - Date Table

Hi All,

 

I'm relatively new to Power BI and have read through the forums and guided learning but am still having difficulty solving the problem YTD. 

 

I tried to use a date table but can't seem to create a relationship to my table that works. The data I have looks something like the table below. I've used a clustered chart to show for each month (axis), the total amount (value) for each ledger (legend). 

 

How do I get the clustered chart to show the cumulative amount for each ledger. So on my clustered chart for February I have the comparison YTD for each ledger? 

 

I've tried to create a date table but can't get it to work with the period numbers (I don't have actual dates in the data only the period number). Because I also have multiple ledger for each year it's difficult to add a column with YY + MM and make it unique. 

 

Any help would be greatly appreciated. 

 

LedgerPeriodAmount
17 Actual11000
17 Actual11500
17 Actual2500
17 Actual31000
17 Actual3700
18 Actual1500
18 Actual21000
18 Actual2500
18 Actual22000
18 Actual3600
18 Budget11000
18 Budget11000
18 Budget21000
18 Budget21000
18 Budget31000
18 Budget31000
  • Anonymous's avatar
    Anonymous
    7 years ago

    In the modelling tab of the menu ribbon there is an area for Data Formatting.  Set the date column's data format into something preferable.

     

    Alternatively, since you created a date table, if you have a month column, you could make use of that column.  If the ordering is wrong, create a month number column in the date table and use the "Sort By Column" option (also modeling tab) whilst you have the month name column selected.  Choose Month Number as the sort column.

  • Anonymous's avatar
    Anonymous
    7 years ago

    Thank you. 

14 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    What stands out to me with your data is the missing date component.  This is likely where you have had some troubles.  Looking at your data you have enough timing information that we could build you some dates but we will need to convert that data into something in the Date format.

     

    For example, if you had monthly data you would simply convert that into dates like the 1st of each month.  If you have quarterly data, you convert that into the 1st of each quarter.

     

    In your data you have <Year> <Type> and then you have the Period.  How long is a period?  Is a period a quarter?  If so, create a column called Period Date and make that date the come from the <Year> information and then choose a month based on the number in the Period slot.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Ross,

       

      Thank you for your help. I've added a date column to my data, but I still can't work out how to get the YTD cumulative by month for each ledger. 

       

      The periods are months, so now my data looks like this. I'm trying to add a measure that I can drag into a cluster chart so show the cumulative YTD each month with month on the x-axis, with a column for each ledger. 

       

      Ledger

      PeriodAmountDate
      17 Actual110001/01/2017
      17 Actual115001/01/2017
      17 Actual25001/02/2017
      17 Actual310001/03/2017
      17 Actual37001/03/2017
      18 Actual15001/01/2018
      18 Actual210001/02/2018
      18 Actual25001/02/2018
      18 Actual220001/02/2018
      18 Actual36001/03/2018
      18 Budget110001/01/2018
      18 Budget110001/01/2018
      18 Budget210001/02/2018
      18 Budget210001/02/2018
      18 Budget310001/03/2018
      18 Budget310001/03/2018