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
EmaVasileva
Helper V
Helper V

Previous row comparison by month and category

Hi Team,

I have the following data:

Month

Person

Target tasks

Fulfilled tasks

Success % (target/fulfilled)

New column - Comment

Dec 2022

A

4

5

125%

 

Jan 2023

A

2

1

50%

No

Feb 2023

A

2

2

100%

Yes

Dec 2022

B

1

1

100%

 

Jan 2023

B

3

5

166.67%

Yes

Feb 2023

B

2

1

50%

No


Month is coming from a Date table, all other fields are coming from another. I want to add a new calc column to compare Success % for every Person separately month vs previous month. If Jan 23 for Person A is bigger than Dec 22, to return “Yes”, if it’s smaller to return “No”, in case of no change to return “Same”. Same logic for Person B, and etc.

For example, if Person A had 125% success in Dec 22, but in Jan 23 had 50%,  I need to see “No” in the Jan 23 row.

I will have new data added for every new month.

Could you please help me with the calculation. Thanks

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

If you want this to be a calculated column you need to expose more of the data model. in lieu of that I modified your Month field slightly.

 

lbendlin_0-1679261584434.png

 

 

 

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Assuming Success % is a measure that you have written, write these measures

Success % pm = calculate([Success %],previousmonth(calendar[date]))

Test = if(isblank([Success % pm]),blank(),if([Success %]>[Success % pm],"Yes",if([Success %]<[Success % pm],"No","Same")))

Hope this helps.


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

If you want this to be a calculated column you need to expose more of the data model. in lieu of that I modified your Month field slightly.

 

lbendlin_0-1679261584434.png

 

 

 

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.

Top Solution Authors