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
MichaelHutchens
Helper IV
Helper IV

Measure to calculate PREVIOUSMONTH inside CALCULATE with USERELATIONSHIP and filter

Hi folks, I'm hoping someone can help. I have a measure below that I'm using to count user ratings:

Count of Positive Ratings =
CALCULATE (
COUNTA ('feedback'[Rated Useful]),
USERELATIONSHIP ('feedback'[Feedback User], 'users'[name] ),
'feedback'[Rated Useful] = "Yes"
)

I'd like to be able to create another '% change of positive ratings last month' measure (using the same COUNTA & USERELATIONSHIP & filter, nested inside a 'CALCULATE') that counts the ratings from 2 months ago.

 

The 'Feedback' table is linked to a 'Calendar' table via an active 'many to one' relationship, so I presume I'd be using this in conjunction with some sort of 'PREVIOUSMONTH' addition to the above measure? Any help would really be appreciated 🙂

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Do these measures work?

Count of Positive Ratings in previous month = calculate([Count of Positive Ratings],previousmonth(calendar[date]))

% change over previous month = divide(([Count of Positive Ratings]-[Count of Positive Ratings in previous month]),Count of Positive Ratings in previous month)

Hope this helps.


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

View solution in original post

4 REPLIES 4
v-cazheng-msft
Community Support
Community Support

Hi @MichaelHutchens 

Is your problem solved? Could you please provide some sample data without sensitive data if this problem haven't been solved? If you have solved it, could you kindly share the solution?

 

Best Regards

Caiyun Zheng

Ashish_Mathur
Super User
Super User

Hi,

Do these measures work?

Count of Positive Ratings in previous month = calculate([Count of Positive Ratings],previousmonth(calendar[date]))

% change over previous month = divide(([Count of Positive Ratings]-[Count of Positive Ratings in previous month]),Count of Positive Ratings in previous month)

Hope this helps.


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

Hi @Ashish_Mathur , apologies for my late reply. This is perfect, thank you so much 🙂

You are welcome.


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

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.