cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DanielClark Regular Visitor
Regular Visitor

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
Moderator v-qiuyu-msft
Moderator

Re: PREVIOUSMONTH - Sum vs. Count using ID relationships

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.
DanielClark Regular Visitor
Regular Visitor

Re: PREVIOUSMONTH - Sum vs. Count using ID relationships

 

@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
Moderator v-qiuyu-msft
Moderator

Re: PREVIOUSMONTH - Sum vs. Count using ID relationships

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.
DanielClark Regular Visitor
Regular Visitor

Re: PREVIOUSMONTH - Sum vs. Count using ID relationships

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
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)