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.
Hi,
I Need a DAX Formula to calculate in the same page 3 different measures depending of the period:
MTD: calculate previous month (April 2019)
YTD: Calculate from SEP 2018 to APRIL 2019
FY: Calculate from SEP 2018 to AUGUST 2019 (I already have a table mapping for this but have an issue when I apply a YTD formula from here: https://www.sqlbi.com/blog/marco/2018/05/22/time-intelligence-issues-in-dax-for-fiscal-years-startin...
Thanks and regards.
Hi @cristianml ,
Could you please post some simple sample data and your desired result to have a test if possible? Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Regards,
Daniel He
Hi @v-danhe-msft ,
Basically I have an issue when I use this formula :
YTD Actual Cost =
CALCULATE (
[Actual Costs],
VAR FirstFiscalMonth = 9 -- Set the first month of the fiscal year
VAR LastDay =
MAX ( 'List Period'[Date Period] )
VAR LastMonth =
MONTH ( LastDay )
VAR LastYear =
YEAR ( LastDay )
- IF ( LastMonth < FirstFiscalMonth, 1 )
VAR FilterYtd =
DATESBETWEEN (
'List Period'[Date Period],
DATE ( LastYear, FirstFiscalMonth, 1 ),
LastDay
)
RETURN
FilterYtd
When I use "Fiscal Year" with Slicer the formula "YTD Actual Cost" shows future values because is considering the complete year (Sep18 to Aug-19) instead of show me until last month that Should go from Sep18 to April-19.
What I would need is to modify the "YTD Actual Cost" formula to calculate till last month instead of using any Date period with Slicer.
With this I would be able to see two different measures:
1 - (YTD) that goes from Sep18 (VAR FirstFiscalMonth = 9) to last month
2 - (FY) that will show values by selecting "Fiscal Year" in Slicer
For MTD I have this measure that works fine and could be useful as an idea to modify the "YTD Actual Cost" formula:
MTD Actual Cost = CALCULATE([Actual Costs], // Sum Amount
DATESBETWEEN('List Period'[Date Period], // Based on Dates Between
Date(YEAR(EDATE(today(),-1)),MONTH(EDATE(today(),-1)),1), // Date having Year = Today -1 Month / Month = today -1 Month, and Day = 1
EOMONTH(today(),-1))) // End Of Month effective today() -1 month
Hope I have explained myself better.
Thanks and regards
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 |
---|---|
110 | |
94 | |
80 | |
67 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |