Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I'm trying to get the starting count from 12 months ago and it should be dynamic to perform R12 calculations. For example:
Ending count = Oct'21
Starting Count = Nov'20
I need help to get the starting count. Any suggestions?
Regards,
Mahesh
Solved! Go to Solution.
Try this:
R12 Start number =
VAR _EndDate =
MAX ( 'Calendar'[Date] )
VAR _StartDateS =
DATE ( YEAR ( _EndDate ) - 1, MONTH ( _EndDate ) - 1, 1 )
VAR _StartDateF =
ENDOFMONTH ( _StartDateS )
RETURN
CALCULATE (
COUNTA ( ExcelDB_Headcount[Employee ID] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Date] >= _StartDateS
&& 'Calendar'[Date] <= _StartDateF
)
)
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
You can use Edate() or Eomonth(),
https://docs.microsoft.com/en-us/dax/edate-function-dax
https://docs.microsoft.com/en-us/dax/eomonth-function-dax
e.g.
Start Date =
VAR _date= MAX('DATE Table'[Date]) //in this example, max date in table is 2021/10/21
var _start=EDATE(_date,-12)
RETURN _start
Start Date =
VAR _date= MAX('DATE Table'[Date]) //in this example, max date in table is 2021/10/21
var _start=EOMONTH(_date,-12)
RETURN _start
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
You can use the PREVIOUSYEAR DAX function to find the solution.
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
hi @VahidDM ,
I'm getting the total of last 12 months if I use the following DAX:
Try this:
R12 Start number =
VAR _EndDate =
MAX ( 'Calendar'[Date] )
VAR _StartDateS =
DATE ( YEAR ( _EndDate ) - 1, MONTH ( _EndDate ) - 1, 1 )
VAR _StartDateF =
ENDOFMONTH ( _StartDateS )
RETURN
CALCULATE (
COUNTA ( ExcelDB_Headcount[Employee ID] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Date] >= _StartDateS
&& 'Calendar'[Date] <= _StartDateF
)
)
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
User | Count |
---|---|
122 | |
77 | |
62 | |
50 | |
44 |
User | Count |
---|---|
177 | |
125 | |
61 | |
60 | |
58 |