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
Wanting to use the following dax command:
EOM =
CALCULATE(
SUM('Table'[SalesYTD]),
ENDOFMONTH('Table'[Date])
)
For most of the months it returns the correct values but for the months april and may it returns blanks. I have looked at the data and there are salesytd values for those months missing, I also did an equivalent formula in sql and it gave me the correct result with values for april and may.
Solved! Go to Solution.
Hi @akhaliq7 ,
I created some data:
ENDOFMONTH():
Returns the last date of the month in the current context for the specified column of dates.
ENDOFMONTH function (DAX) - DAX | Microsoft Learn
In the data I created, there was no data on the last day of April, so the entire Month of April data would be blank
If you want to display the last data of each month, you can use the following formula:
Here are the steps you can follow:
1. Create measure.
EOM_true =
SUMX(FILTER(ALL('Table'),
'Table'[Year]=MAX('Table'[Year])&&
'Table'[Month]=MAX('Table'[Month])&&
'Table'[Date]=
MAXX(FILTER(ALL('Table'),
'Table'[Year]=MAX('Table'[Year])&&
'Table'[Month]=MAX('Table'[Month])&&
NOT( ISBLANK('Table'[SalesYTD]))),[Date]) ),[SalesYTD])
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
If you are working with dates, Best Practices recommend the use of a Calendar Table. This will avoid problems related to Time Intelligence for example
here is one way of creating one by the gurus at sqlbi.com
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Proud to be a Super User!
Paul on Linkedin.
Hi @akhaliq7 ,
I created some data:
ENDOFMONTH():
Returns the last date of the month in the current context for the specified column of dates.
ENDOFMONTH function (DAX) - DAX | Microsoft Learn
In the data I created, there was no data on the last day of April, so the entire Month of April data would be blank
If you want to display the last data of each month, you can use the following formula:
Here are the steps you can follow:
1. Create measure.
EOM_true =
SUMX(FILTER(ALL('Table'),
'Table'[Year]=MAX('Table'[Year])&&
'Table'[Month]=MAX('Table'[Month])&&
'Table'[Date]=
MAXX(FILTER(ALL('Table'),
'Table'[Year]=MAX('Table'[Year])&&
'Table'[Month]=MAX('Table'[Month])&&
NOT( ISBLANK('Table'[SalesYTD]))),[Date]) ),[SalesYTD])
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi, @akhaliq7 ,
If the data in your table are missing, it should show blank as there are basically 0, if you to display 0, you can add "+0" to your measure so it doesn'T show blank.
Otherwise, can you share your data in text form and maybe explain more, what you need?
User | Count |
---|---|
117 | |
74 | |
62 | |
50 | |
45 |
User | Count |
---|---|
174 | |
125 | |
60 | |
60 | |
57 |