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.
Hey everybody,
how can I show dynamically the same month that I choose in 2022 for the last years.
If I choose from 1. March- 31. March 2022, I want that the fields show unter the sale years, the sales for 1. March 2020 - 31. March 2020 and 1. March 2021 - 31. March2021.
You have an idea for a dax?
Thank you all.
Solved! Go to Solution.
Hi @azaterol ,
Please try these measures.
Current year sales =
CALCULATE (
SUM ( 'Sales'[Sales] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Year]
= MAX ( 'Calendar'[Year] )
&& 'Calendar'[Month] = MAX ( 'Calendar'[Month] )
)
)
Last year sales =
CALCULATE (
SUM ( 'Sales'[Sales] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Year]
= MAX ( 'Calendar'[Year] ) - 1
&& 'Calendar'[Month] = MAX ( 'Calendar'[Month] )
)
)
Previous year sales =
CALCULATE (
SUM ( 'Sales'[Sales] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Year]
= MAX ( 'Calendar'[Year] ) - 2
&& 'Calendar'[Month] = MAX ( 'Calendar'[Month] )
)
)
Please feel free to let me know if I misunderstood your needs.
The PBIX file is attached for reference.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Hi @azaterol ,
Please try these measures.
Current year sales =
CALCULATE (
SUM ( 'Sales'[Sales] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Year]
= MAX ( 'Calendar'[Year] )
&& 'Calendar'[Month] = MAX ( 'Calendar'[Month] )
)
)
Last year sales =
CALCULATE (
SUM ( 'Sales'[Sales] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Year]
= MAX ( 'Calendar'[Year] ) - 1
&& 'Calendar'[Month] = MAX ( 'Calendar'[Month] )
)
)
Previous year sales =
CALCULATE (
SUM ( 'Sales'[Sales] ),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Year]
= MAX ( 'Calendar'[Year] ) - 2
&& 'Calendar'[Month] = MAX ( 'Calendar'[Month] )
)
)
Please feel free to let me know if I misunderstood your needs.
The PBIX file is attached for reference.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
User | Count |
---|---|
116 | |
73 | |
59 | |
48 | |
48 |
User | Count |
---|---|
171 | |
122 | |
60 | |
59 | |
56 |