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
Anonymous
Not applicable

PREVIOUSMONTH + FILTER return blank

Hi Experts

I tried to use a combination of PREVIOUSMONTH and FILTER, but only got blank. It works well when only one filter is applied.

I went through related topics here and tested couple of solutions like ALL.

With All applied I can see value returned, but all remain the same at different level, apparantly not acceptable.

Below is how I wrote it:

Reserve@GC-1 = CALCULATE(SUM(TotalReserve[Total Value (GC)]),PREVIOUSMONTH('TIME'[MonthDate]),FILTER(TotalReserve,TotalReserve[Type]="Reserve"))
Thanks.

yamacha_0-1616572640716.png

yamacha_1-1616572758628.png

 

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Does this work?

Reserve@GC-1 = CALCULATE(SUM(TotalReserve[Total Value (GC)]),PREVIOUSMONTH('TIME'[MonthDate]),TotalReserve[Type]="Reserve")


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

9 REPLIES 9
Ashish_Mathur
Super User
Super User

Hi,

Does this work?

Reserve@GC-1 = CALCULATE(SUM(TotalReserve[Total Value (GC)]),PREVIOUSMONTH('TIME'[MonthDate]),TotalReserve[Type]="Reserve")


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Ashish, it works! I didn't see PREVIOUSMONTH function can support 2nd expression before, even on MS DOCS.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Ashish

After the formula applied I noticed that the tabel subtotal returns something very exaggerated.

It didn't return simple column sum as expected, especially the last column the result is way too big, like multiplied by somthing. Do you have any idea on this?Thanks.

yamacha_1-1616651188223.png

 

 

Hi,

Share the link from where i can download your PBI file.  Please also show the expected result clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@Anonymous , make sure time table marked as date tbale and try a formula like

 

Reserve@GC-1 = CALCULATE(SUM(TotalReserve[Total Value (GC)]),DATESMTD(dateadd('Time'[MonthDate],-1,MONTH),FILTER(TotalReserve,TotalReserve[Type]="Reserve"))

 

also use month date from Time table in visual

Anonymous
Not applicable

Thanks Amitchandak, time table is in date formate, but the result remains. Per my understanding DATESMTD seemly  works the same way as PREVIOUSMONTH. 

yamacha_0-1616573753935.png

yamacha_1-1616574041362.png

 

 

@Anonymous ,Can you share a sample pbix after removing sensitive data?

 

Refer to my video for 5 reasons time intelligence can fail - https://www.youtube.com/watch?v=OBf0rjpp5Hw

Anonymous
Not applicable

Hi Amit

The raw data is huge with indeed lots of sensitive info, not handy to share here.

But I have attached the model above, very simple with only 3 tables: 2 master and 1 fact.

Wonder if it possible to digest over this? You may ask me anything and I will reply shortly.

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.