Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi there,
I am working with a dataset, which has sales data starting from January 2022 to March 2024. I was trying to calculate latest month sales, i.e. March 2024. I want to make it dynamic so that if I add sales of upcoming months, it will show latest month.
I have a sales table and a calender table.
When I using dates from sales table, it kind of work:
Revenue (CM) =
CALCULATE(
[Total Revenue],
FILTER(
Data,
EOMONTH(Data[Date of Purchase],0) >= EOMONTH(MAX(Data[Date of Purchase]),0) &&
EOMONTH(Data[Date of Purchase],0) <= TODAY()
)
)
Any help will be highly appreciated. Thanks
yes, in this case you need to use the latest [Date of Purchase] from the fact table. But you need to define that as a variable outside of CALCULATE.
Hi Ibendlin, thanks for your reply.
It actually works when I use latest [Date of Purchase] from fact table but doesn't work when using dimension table, i.e. Calendar table. And it seems like there is an issue with Calendar table. I tried several things to debug, such as importing fresh calendar table in different formats, creating new calendar table using Dax it doesn't work.
I more thing I have noticed, whenever I create or import new calendar table, it's hierarchy disappears as soon as I mark it as date table or after data modeling and connecting to fact table. Any idea what's going on?
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
12 | |
10 | |
6 |