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
DataVitalizer
Super User
Super User

PreviousMonth returns blank values [DAX]

Hi Community,

I have two tables T1 contains values for each store by city and date, and T2 is a date table

The problem shows up when trying to return the previous value of the store all returned values are blank

PreviousMonth DAX Blank.png

The formula used in the new calculated column is 

PreviousMonth DAX formula.png

Here is the result I am looking for

PreviousMonth DAX Result.png

Thank you in advance.

1 ACCEPTED SOLUTION
v-qiuyu-msft
Community Support
Community Support

Hi @DataVitalizer

 

You can create a measure below: 

 

PreviousMonth = CALCULATE(SUM(Table1[MonthlyValue]),PREVIOUSMONTH('Datetable'[Date]),ALLEXCEPT(Table1,'Table1'[City],'Table1'[Store]))
 
q1.PNG
 
Best Regards,
Qiuyun Yu
Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-qiuyu-msft
Community Support
Community Support

Hi @DataVitalizer

 

You can create a measure below: 

 

PreviousMonth = CALCULATE(SUM(Table1[MonthlyValue]),PREVIOUSMONTH('Datetable'[Date]),ALLEXCEPT(Table1,'Table1'[City],'Table1'[Store]))
 
q1.PNG
 
Best Regards,
Qiuyun Yu
Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you v-qiuyu-msft. I do appreciate your help

kcantor
Community Champion
Community Champion

@DataVitalizer 

I would suggesting visiting the community to post this in the desktop section or the Dax section as this particular site is for reporting issues with the actual product and not with a calculation. 

 

You may want to include a little more info with the post including a snapshot or your model relationships as well in order to diagnose the calculation issue. It seems that the Dax is having an issue defining last month. It may be the relationship or the field you are adding. Your calculation references your column of [Date] but the display shows DateTable. You may want to try droping [Date] on the visual instead of DateTable.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.