Forum Discussion
In and out-flow from money. Create difference and aggregate value by month.
hi sven7,
Create a month column on your calendar table and place that column on your visual
Regards,
Mfelix
Hi MFelix,
I used both ways, I am so far that it shows the balance or difference by each month, but not the rolling value. Also it is only showing 2017 and no previous years.
Any further tips are much appreciated thank you so much for your help.
- MFelix8 years ago
Super User
Hi sven7,
My error mixup two different solutions I was working on.
Create the relationship between both tables and then add this measure:
Balance = TOTALYTD(SUM(Money_In_Out[Amount received])-SUM(Money_In_Out[Amount taken]),'Calendar'[Date])
The other formula without links was to make it month on month no matter the Year so the balence from december would go to January
In that case you need to use the formula:
Balance_1 = var dimdate = MAX('Calendar'[Date]) return CALCULATE(SUM(Money_In_Out[Amount received])-SUM(Money_In_Out[Amount taken]),Money_In_Out[Date] <= dimdate)and don't connet the tables.
Regards,
MFelix
- MFelix8 years ago
Super User
If you are using the first measure YTD create a relationship between the two tables.
- sven78 years agoFrequent Visitor
MFelix This also works now with the connection to the other table and using the balance formula. However, it gives me the same picture again that it does not show the rolling value. I could only link the date between the tables not the month, following error:
Thanks Sven
- MFelix8 years ago
Super User
You must link the date columns but use the.month colum from calendar table on your.visual - sven78 years agoFrequent Visitor
Yes, I tried that but that does not work. It only shows me the difference by month and no rolling value.
I also tried this from
http://www.daxpatterns.com/cumulative-total/
but same graph is shown. Can it be because of my calendar or any other formatting issues maybe?
Cumulative Quantity := CALCULATE ( SUM ( Transactions[Quantity] ), FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) ) ) - MFelix8 years ago
Super User
The auto calendar gives you the a calendar based on your minimum.and maximim date on your model in order for the YTD to.work you need to have a calendar starting in january.and ending un december I would add the calendar like this.
Calendar =
CALENDAR (
DATE ( YEAR ( MIN ( Transactions[Date] ) ), 1, 1 ),
DATE ( YEAR ( MAX ( Transactions[Date] ) ), 12, 31 )
)
Then try the TOTALYTD formula - sven78 years agoFrequent Visitor
MFelix Thank you so much for help, I really appreciate your help. Unfortunately still the same issue. I have got the YTD formula, I have set the calendar, I have linked the dates from the logs file and calendar and as the visual I have selected the dates from the calendar.
- MFelix8 years ago
Super User
Hi sven7,
I have used your data and produced this two models below one with the YTD values and another with the calculated values as you can see both make the same result. so total YTD values sum up to total year, on the second table the rollup goes trough 2018.
Can you send a print with the measures and table to check the values please.
Regards,
MFelix