Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
CleliaComes
Helper I
Helper I

Need help with formula DAX for calculating financial ratio

Hi guys

 

I am trying to calculate financial ratio’s Year of Year with a slicer.

In my database I have the financial data for the year 2020 + January 2021.

 

For example I calculated the ratio "solvability : equity / total liabilities".  

 

Equity:
Eigen vermogen = -(CALCULATE('Measures JR'[SOM BS],Rubrieken[Rubriek]="Eigen vermogen")+[SOM PL])

 

Total liabilities:
Totaal vermogen = [Eigen vermogen]+[vreemd vermogen]
Loan capital:  vreemd vermogen: = -(CALCULATE('Measures JR'[SOM BS],Rubrieken[Rubriek]="Vreemd vermogen KT") + CALCULATE('Measures JR'[SOM BS],Rubrieken[Rubriek]="Vreemd vermogen LT"))

 

Solvability:
Solvabiliteit = [Eigen vermogen]/[Totaal vermogen]

 

When I use my date filter ‘Year’ I receive for 2021 the mutations for that year and not the cumulated figure 2020 (openings balance) + 2021 as expected in a balance ratio.

I can select more cases in the filter but I was wondering If there is a formular to solve this problem?

 

 

ratio 2020ratio 2020Ratio 2.png

Kind regards,

Clélia

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@CleliaComes , Formula which you need for last year is not clear , But you can Time intelligence with Date table to get measures for this year and last year example

 

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"))

 

This can be done with separate year table with data at year level

 

This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

 

You can create measures for this year and last year and use those

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

 

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 :radacad sqlbi My Video Series Appreciate your Kudos.

View solution in original post

2 REPLIES 2
CleliaComes
Helper I
Helper I

Thanks a lot for your answer. With the integration of the time intelligence functions the problem was solved and I have nog the cumulated figure. 
Kr

Clélia

amitchandak
Super User
Super User

@CleliaComes , Formula which you need for last year is not clear , But you can Time intelligence with Date table to get measures for this year and last year example

 

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"))

 

This can be done with separate year table with data at year level

 

This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

 

You can create measures for this year and last year and use those

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

 

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 :radacad sqlbi My Video Series Appreciate your Kudos.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.