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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
jl20
Helper IV
Helper IV

Need Help with Conditional Allocation Formula

Hi,

 

This is a follow-up to a question I posted yesterday. I'm trying to figure out how to achieve the following outcome. I want a calculated column or measure to recalculate the estimated revenue column based on what's in the revenue to date column (to avoid double counting). Ultimately I want to be able to slice on workgroup and sum up the adjusted total of the estimated revenue column. Any ideas? Thanks in advance!

 

Syntax question.JPG

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jl20,

 

I modified the formula based on your sample data, you can try it if suitable for your requirement.

 

Dynamic Revenue = 
var currProj=Max([MatterId])
var currRevenue= Max('Sample Data'[FeesBilled])
var totalEsti= SUMX(FILTER(ALL('Sample Data'),[MatterId]= currProj),[EstimatedFees])
var totalRevenue= SUMX(FILTER(ALL('Sample Data'),[MatterId]= currProj),[FeesBilled])
var groupCount=Calculate(DistinctCount('Sample Data'[WorkgroupName]),ALL('Sample Data'),'Sample Data'[MatterId]= currProj)
return
 IF(groupCount>1,
 if(currRevenue<>0, currRevenue/totalRevenue *totalEsti, Data'),[MatterId]= currProjAVERAGEX(FILTER(ALL('Sample ),[EstimatedFees])),Max([EstimatedFees]))

 

 

Capture.PNG

 

Regards,

Xiaoxin Sheng

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi @jl20,

 

You can try to use below formula if it suitable for your requirement.

Sample measure:

Dynamic Revenue=
var currProj=Max([Project #])
var currRevenue= Max(Table[Revenue to Date])
var totalEsti= SUMX(FILTER(ALL(Table),[Project #]= currProj),[Estimated Revenue])
var totalRevenue= SUMX(FILTER(ALL(Table),[Project #]=currProj),[Revenue to Date])
var groupCount=Calculate(DistinctCount(Table[Workgroup]),Table[Project #]= currProj)
return
 IF(groupCount>1,
 if(currRevenue<>0, currRevenue/totalRevenue *totalEsti,AVERAGEX(FILTER(ALL(Table),[Project #]= currProj),[Revenue to Date])),Max(Estimated Revenue]))

 

If above is not help, please share some sample data to test.

 

Regards,
Xiaoxin Sheng

That seemed to give me some weird results that didn't make much sense. How can I attach an excel file with sample data?

Anonymous
Not applicable

Hi @jl20,

 

You can upload to 1dv and share us the link.

 

Regards,

Xiaoxin Sheng

It looks like I am restricted from sharing on 1dv outside my organization. Is there another service I can use to share?

 

EDIT: Try this link: 

https://srr-my.sharepoint.com/personal/jleins_srr_com/_layouts/15/guestaccess.aspx?guestaccesstoken=...

Anonymous
Not applicable

Hi @jl20,

 

I can't reach to your link, I think you can also try to use google drive.

 

Share a document using SharePoint or OneDrive

 

Regards,

Xiaoxin Sheng

Here's a link that should work:

 

Sample Data Set

 

 

Anonymous
Not applicable

Hi @jl20,

 

I modified the formula based on your sample data, you can try it if suitable for your requirement.

 

Dynamic Revenue = 
var currProj=Max([MatterId])
var currRevenue= Max('Sample Data'[FeesBilled])
var totalEsti= SUMX(FILTER(ALL('Sample Data'),[MatterId]= currProj),[EstimatedFees])
var totalRevenue= SUMX(FILTER(ALL('Sample Data'),[MatterId]= currProj),[FeesBilled])
var groupCount=Calculate(DistinctCount('Sample Data'[WorkgroupName]),ALL('Sample Data'),'Sample Data'[MatterId]= currProj)
return
 IF(groupCount>1,
 if(currRevenue<>0, currRevenue/totalRevenue *totalEsti, Data'),[MatterId]= currProjAVERAGEX(FILTER(ALL('Sample ),[EstimatedFees])),Max([EstimatedFees]))

 

 

Capture.PNG

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors