Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi All
Hoping someone can help me out here.
As part of a report I have a measure that calculates the ratio between contract value and funding we have approved. As there is some lag in reporting we need to exclude the current financial year when calculating this ratio. I've got the following measure:
Solved! Go to Solution.
Managed to get the following to work. I'll admit it isn't the cleanest way of achieving it but it works for what I'm trying.
Leverage Ratio v3 =
VAR __MaxFinYear = MAXX(ALL('Calendar'),[FinYearNumber])
VAR __SelectedFinYear = SELECTEDVALUE('Calendar'[FinYearNumber])
RETURN
IF(__SelectedFinYear = __MaxFinYear,
CALCULATE(
DIVIDE(
SUM('Grants Data'[Total Value of Major Contracts Reported]),
SUM('Grants Data'[Funds Approved (Exc. GST)]),
0
),
FILTER(ALL('Calendar'), 'Calendar'[FinYearNumber] < __MaxFinYear)
),
IF(SELECTEDVALUE('Calendar'[FinYearNumber]) = BLANK(),
CALCULATE(
DIVIDE(
SUM('Grants Data'[Total Value of Major Contracts Reported]),
SUM('Grants Data'[Funds Approved (Exc. GST)]),
0
),
FILTER(ALL('Calendar'), 'Calendar'[FinYearNumber] < __MaxFinYear)),
DIVIDE(SUM('Grants Data'[Total Value of Major Contracts Reported]),
SUM('Grants Data'[Funds Approved (Exc. GST)]),
0)))
@Anonymous - Try this:
Leverage Ratio =
VAR __MaxFinYear = MAXX(ALL('Calendar'),[FinYearNumber])
RETURN
CALCULATE(
DIVIDE(
SUM('Grants Data'[Total Value of Major Contracts Reported]),
SUM('Grants Data'[Funds Approved (Exc. GST)]),
0
),
FILTER(ALL('Calendar'), 'Calendar'[FinYearNumber] < __MaxFinYear)
)
Assuming that your calendar only has up through the current financial year this should work.
Thanks for that. Apologies in the delay for getting back to you.
This doesn't seem to work how I was expecting.
This is good in that it will only show the leverage ratio for the data up to and including the previous financial year. So it's now essentially a static data point that will change when we move into the next financial year (which is not a bad thing).
However, what I was hoping for was that when I slice to a prior financial year (say 2014/15) it will show me the leverage ratio for the data up to that financial year and only if I have sliced to the current financial year (2020/21) or have no slicer value will it ignore data for the current financial year. Does that make sense?
My calendar table has two financial year fields: FinYearNumber which calculates the financial year as a year (ie. 2020), and FinYearDisplay which displays the financial year as something like 2020/2021. I use FinYearDisplay in my slicers, so I'm not sure if that is having an effect here.
Thanks
Managed to get the following to work. I'll admit it isn't the cleanest way of achieving it but it works for what I'm trying.
Leverage Ratio v3 =
VAR __MaxFinYear = MAXX(ALL('Calendar'),[FinYearNumber])
VAR __SelectedFinYear = SELECTEDVALUE('Calendar'[FinYearNumber])
RETURN
IF(__SelectedFinYear = __MaxFinYear,
CALCULATE(
DIVIDE(
SUM('Grants Data'[Total Value of Major Contracts Reported]),
SUM('Grants Data'[Funds Approved (Exc. GST)]),
0
),
FILTER(ALL('Calendar'), 'Calendar'[FinYearNumber] < __MaxFinYear)
),
IF(SELECTEDVALUE('Calendar'[FinYearNumber]) = BLANK(),
CALCULATE(
DIVIDE(
SUM('Grants Data'[Total Value of Major Contracts Reported]),
SUM('Grants Data'[Funds Approved (Exc. GST)]),
0
),
FILTER(ALL('Calendar'), 'Calendar'[FinYearNumber] < __MaxFinYear)),
DIVIDE(SUM('Grants Data'[Total Value of Major Contracts Reported]),
SUM('Grants Data'[Funds Approved (Exc. GST)]),
0)))
@Anonymous - Did you get your issue resolved?
@Anonymous , Not very cleat but you can use time intelligence with a date table
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"5/31")) // End year of choice
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"5/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"5/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"5/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"5/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
//Only year vs Year, not a level below, Here year is FY Year
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))
FY Year of choice -https://community.powerbi.com/t5/Community-Blog/Creating-Financial-Calendar-Decoding-Date-and-Calendar-1-5-Power/ba-p/1187441
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 :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
Appreciate your Kudos.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
102 | |
84 | |
79 | |
70 |
User | Count |
---|---|
120 | |
110 | |
95 | |
82 | |
77 |