Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bimagty
Frequent Visitor

Previous Month goes blank on some Month

Hello,

 

I have problem with previous month dax. I want to show last month sales revenue based on the slicer, but when I select year of 2022 and month in February, this 'last month' card should display the sum of revenue in January but it shows ((blank)).

 

I tried to change the year to 2021 and it worked fine.

Below the captures:

 

bimagty_0-1645963273500.png

 

I already have 2 tables, 1 table is for data and another 1 for calendar, below are my codes:

last month = CALCULATE (
    SUM('190222'[daily_revenue]),
    PREVIOUSMONTH ( 'Calendar'[Date].[Date] ) )

 

And this is the table relationship:

bimagty_1-1645963400736.png

 

 This is the result when I tried to change the year to 2021:

bimagty_2-1645963451952.png

 

Please help if there is something that I skipped to make it error. Thanks in advance!

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@bimagty Well, make sure you have a separate date table and that it is marked as a date table. Also, you don't need the .[Date] portion. Alternatively, just say no to DAX time "intelligence" functions.

 

You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@bimagty Well, make sure you have a separate date table and that it is marked as a date table. Also, you don't need the .[Date] portion. Alternatively, just say no to DAX time "intelligence" functions.

 

You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thank you Greg, it is solved.

I marked the table which contains date as date table, and the result is ok now.

 

bimagty_0-1645969013328.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors