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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
DanielClark
Helper II
Helper II

PREVIOUSMONTH - Sum vs. Count using ID relationships

Hi,

 

I am trying to use the previous month function to grab the Sum, Count and CountRows just to try all the options here. Previosuly I was summing aggregates of transactions. Now I have a denormalized table and am trying to count the rows of the table instead to work out the values.

 

For some reason, I am not getting anything consistenatly returned from the below:

 

I have two reports that are identical from what I can see, containing the 3 measures below:

Sum Previous = CALCULATE(SUM('Test Data'[Value]) + Sum('Test Data'[Custom]), PREVIOUSMONTH('Test Data'[Date]))

CountRows Previous = CALCULATE(COUNTROWS('Test Data') + COUNTROWS('Test Data'), PREVIOUSMONTH('Dates'[Date]))

Count Previous = CALCULATE(COUNT('Test Data'[Value]) + COUNT('Test Data'[Custom]), PREVIOUSMONTH('Dates'[Date]))

 

In Report Test the Previous Month function works with Sum. But not with Count or CountRows.

Sum Previous Working.PNG

In Report Test 2 the Previous Month function works with Count and CountRows. But not with Sum.
Count Previous Working.PNG
What is going on? It seems like a bug. But I may have missed something.

 

Further to this, when working with a date table, should my date key always be converable to a date, I have been given a new date data set and the PK is now an ID rather than convertable to date in PowerBI. As seen in Contoso Sales Sample.

 

 

Regards,

Daniel Clark
Business Insight Data Modeler @ BRIGHTSTARR
4 REPLIES 4
v-qiuyu-msft
Community Support
Community Support

Hi @DanielClark,

 

Would you please share the .pbix file which has 'Test Data' and 'Dates' tables for our analysis?

 

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.

 

@v-qiuyu-msft,

 

What is the best way to share them as I do not seem to be able to attach files to posts.

 

Regards,

Daniel Clark
Business Insight Data Modeler @ BRIGHTSTARR

Hi @DanielClark,

 

You can upload files to OneDirve or Dropbox then share the link here.

 

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.

Hi @v-qiuyu-msft,

 

Sorry for the delay; Here are the files: https://1drv.ms/f/s!AhNB5S6yOcRppif1mUg6jqJfySmj

 

Regards,

 

Daniel Clark

Daniel Clark
Business Insight Data Modeler @ BRIGHTSTARR

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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