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
SharonHMA
Helper I
Helper I

Change between groups that are not a date

Hello,

 

I have data from 3 separate studies.  I have combined the data into one table with a column marking each row as coming from Study A, Study B, or Study C.  I can show visuals or grids that separate my measures/data by Study easily however I would like to calculate the differences in different aggregates (study over study growth) between Study C and Study B, and Study B and Study A.  Is there a way to do this?  I know how to do this with time functions (sameperiodlastyear), but not a column that segregates data by text value.

 

If anyone has any ideas I'd appreciate the help,

 

Sharon

1 ACCEPTED SOLUTION
v-sihou-msft
Employee
Employee

@SharonHMA

 

In this scenario, to do a "Study over Study" comparison, you can create a numeric column marking different studies like 1,2,3,etc. Then you can create a calculated column to get the Previous Study Total.

 

Previous Study Total = CALCULATE(SUM(Table2[Value]),FILTER(Table2,Table2[study number]=EARLIER(Table2[study number])-1))

44.PNG

 

 

Then you can create a measure to calculate the growth percentage.

 

Study Over Study Growth = AVERAGE(Table2[Previous Study Total])/CALCULATE(SUM(Table2[Value]))

55.PNG

 

 

Regards,

View solution in original post

4 REPLIES 4
v-sihou-msft
Employee
Employee

@SharonHMA

 

In this scenario, to do a "Study over Study" comparison, you can create a numeric column marking different studies like 1,2,3,etc. Then you can create a calculated column to get the Previous Study Total.

 

Previous Study Total = CALCULATE(SUM(Table2[Value]),FILTER(Table2,Table2[study number]=EARLIER(Table2[study number])-1))

44.PNG

 

 

Then you can create a measure to calculate the growth percentage.

 

Study Over Study Growth = AVERAGE(Table2[Previous Study Total])/CALCULATE(SUM(Table2[Value]))

55.PNG

 

 

Regards,

Hi Simon

 

Do you know why I am receiving this error?  My study number is number, it's basically 1,2 or 3 from a conditional column based on study ie Study = A, then 1 etc.

 

error says EARLIER/EARLIEST refers to an earlier row context which doesn't exist.  I can't seem to enter any columns after EARLIER.

 

 

SoS.PNG

 

Thank you!  This is the better solution as I add studies down the road, I can increase the numeric values to match.  I appreciate the direction. So easy once you see it.

Create sum measures for each study:

CALCULATE(SUM(Table[FieldToSum]),FILTER(Table,Table[Study] = "A"))

Then create measures for growth (measureSumA/measureSumB - 1)

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