Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi,
I have column Date and Sales ,I need to show data on last selected month(last date) if multiple months are selected ans same for previous month
Providing snap of dummy Data and expected result
if I select Jan-21,Feb-21,Mar-21
I want Current Month Sales as = 100 (data on last date of march)
Previous Month = 150 (data on last date of dec)
Can anyone pls suggest me how to solve this?
Thanks.
Solved! Go to Solution.
Hi @Anonymous ,
Please check these formulas:
Current Month =
var max_date = CALCULATE(MAX('Table'[date]),ALLSELECTED('Table'))
return
CALCULATE(SUM('Table'[sales]),FILTER(ALL('Table'),'Table'[date]=max_date))
Previous Month =
var max_date = CALCULATE(MAX('Table'[date]),ALLSELECTED('Table'))
var count_months = DISTINCTCOUNT('Table'[Month year])
var pre_date = EDATE(max_date,-count_months)
return
CALCULATE(SUM('Table'[sales]),FILTER(ALL('Table'),'Table'[date]=pre_date))
Best Regards,
Jay
Hi Amit,
Thanks for your Reply ,but its not working in my case I am sharing an Image with Deatiled Explaination
Firstly I have tried your DAX it is giving me Blank If I select single month.
and If I select Multilple Month as above Image It is till incorrect
As I have selected (2019-03,2019-04) so what I want is , it should reflect (4198259)
Any help on this ?
Hi @Anonymous ,
Please check these formulas:
Current Month =
var max_date = CALCULATE(MAX('Table'[date]),ALLSELECTED('Table'))
return
CALCULATE(SUM('Table'[sales]),FILTER(ALL('Table'),'Table'[date]=max_date))
Previous Month =
var max_date = CALCULATE(MAX('Table'[date]),ALLSELECTED('Table'))
var count_months = DISTINCTCOUNT('Table'[Month year])
var pre_date = EDATE(max_date,-count_months)
return
CALCULATE(SUM('Table'[sales]),FILTER(ALL('Table'),'Table'[date]=pre_date))
Best Regards,
Jay
Thaaaank You sooo much ....exactly the solution I needed!
Hi
Hi @Anonymous ,
I have one more query ,I am unable to filter above calculated measure with other column ,
how can I resolve this
Hi @Anonymous ,
You can add the condition to the filter function.
For example:
CALCULATE(SUM('Table'[sales]),FILTER(ALL('Table'),'Table'[date]=max_date&&'table'[column]=selectedvalue(othercolumn)))
Best Regards,
Jay
Am I missing anything in this ? plus I want to filter two different column (i.e.platform and type )values
Hi @Anonymous
I have resolved filtering part ,using below measure it seems to work
but now I am not geting incorrect value if I am selecting last month as feb
as per my requirement it should give me data on sept 30 but it is giving value for sept 28 please refer blow image
and It is working fine with other months selection only causing this issue if I am selecting feb as my latest month
its not working in my case Thanks for the reply
Check out the November 2025 Fabric update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!