The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Experts
i cannot understand why i am getting constant on the previous 12 months DAX Measure when i add the measure to my calender table....to see the end results...
Solved! Go to Solution.
That is because the measure is not taking into account the calendar table, it is using fixed values. If you want to show the total value for the previous 12 months taking into account your calendar table you can use
Rolling 12 till last month FEP =
VAR EndDatelastMonth = MAX('Calendar'[Date])
VAR StartDate = DATE(YEAR(EndDatelastMonth) - 1,MONTH(EndDatelastMonth),1)
VAR Result = CALCULATE( [MONTHLY TOTAL (FEP)],
REMOVEFILTERS('Calendar'),
DATESBETWEEN( 'Calendar'[Date], StartDate, EndDatelastMonth ))
RETURN
Result
Change your start date to DATE( YEAR(TODAY())-1, MONTH(TODAY()), 1)
My Start date should be start of the month 12 months ago....not the previous month??? unless i am missing something
My formula is giving the start of the current month last year, so at the moment it is returning 2021-03-01. It is just subtracting 1 from the current year.
Ok but i am getting constant value when i use Year and Month from the calenar table and plot this on a bar chart
That is because the measure is not taking into account the calendar table, it is using fixed values. If you want to show the total value for the previous 12 months taking into account your calendar table you can use
Rolling 12 till last month FEP =
VAR EndDatelastMonth = MAX('Calendar'[Date])
VAR StartDate = DATE(YEAR(EndDatelastMonth) - 1,MONTH(EndDatelastMonth),1)
VAR Result = CALCULATE( [MONTHLY TOTAL (FEP)],
REMOVEFILTERS('Calendar'),
DATESBETWEEN( 'Calendar'[Date], StartDate, EndDatelastMonth ))
RETURN
Result
User | Count |
---|---|
77 | |
76 | |
36 | |
31 | |
29 |
User | Count |
---|---|
93 | |
81 | |
57 | |
48 | |
48 |