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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ethanlsaul
Helper I
Helper I

Using a measure to calculate %

I have 2 tables. 

 

Table1 is what the qty i asked for. Example: I asked my supply chain partners for 10 markers for next week.  

 

ProductWeek1
Markers10

 

Table2 is what I recived the following week (week1). Example: I recieved 3 markers.

 

ProductWeek1
Markers3

 

I want to create a measure that says I recieved 30% of what i asked for. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @ethanlsaul ,

Here are the steps you can follow:

1. Create measure.

Measure =
var _table1=CALCULATE(SUM('Table1'[quantity]),FILTER(ALL('Table1'),'Table1'[Product]=MAX('Table1'[Product])&&'Table1'[Week]=1))
var _table2=CALCULATE(SUM('Table2'[Recieved]),FILTER(ALL(Table2),'Table2'[Product]=MAX('Table2'[Product])))
return
DIVIDE(
    _table2,_table1)

2. Result:

vyangliumsft_0-1654587692385.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi  @ethanlsaul ,

Here are the steps you can follow:

1. Create measure.

Measure =
var _table1=CALCULATE(SUM('Table1'[quantity]),FILTER(ALL('Table1'),'Table1'[Product]=MAX('Table1'[Product])&&'Table1'[Week]=1))
var _table2=CALCULATE(SUM('Table2'[Recieved]),FILTER(ALL(Table2),'Table2'[Product]=MAX('Table2'[Product])))
return
DIVIDE(
    _table2,_table1)

2. Result:

vyangliumsft_0-1654587692385.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

lbendlin
Super User
Super User

Change your table structure

 

Product Week Requested Received
Markers 1 10 3

 

Then the percentage calculation becomes easy.

Hi Ibedlin,

 

Hi There,

 

I just realized my inital post's table got messed up. 

 

  

Column 1 = Product

Column 2 = Requested #

Product || Requested #

Markets || 10

 

Table 2 

Product || Recieved

 

 

Assume i cannot change the way the raw data is given as they 2 tables come from different source data. Is a measure impossible?

The best approach is to merge your tables in Power Query to arrive at the format I mentioned.

 

You can create measures with the tables being separate but that would be contrary to the Power BI design ideas, and would result in a fragile solution.

I tried to merge, but for some reason, after i merged, it had the columns from table 1 and the table 2 was a single column that it wanted me to drill down. Any tips on how to do it correctly?

You are supposed to expand that new column, not drill down into any of the values.  Use the icon in the column header.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors