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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
jakechevrier
Frequent Visitor

Sum one table by category, multiply by a series of annual factors, get sum by year

Hoping my diagram below makes this more clear than unclear...

 

I have two tables: Item & Projection factors

  1. I'd like to sum the Qty by category...
  2. Multiply each sum by a series of annual values...
  3. Then sum the result per year

 

I'm not sure if this should be a measure, a column, or a helper table, but would really appreciate any insight for how to make this happen in powerbi.

 

Thank you!

 

jakechevrier_1-1675203141308.png

 

1 ACCEPTED SOLUTION
v-binbinyu-msft
Community Support
Community Support

Hi @jakechevrier ,

Please try below steps:

1. add a new column to Projection factors table with below dax formula

Sum Qty =
VAR cur_cty = [Category]
VAR tmp =
    FILTER ( ALL ( 'Item' ), 'Item'[Category] = cur_cty )
RETURN
    SUMX ( tmp, [Qty] )

vbinbinyumsft_0-1675217680412.png

 2.  create a measure with below dax formula

Measure =
VAR cur_year =
    SELECTEDVALUE ( 'Project Factors'[Year] )
VAR tmp =
    FILTER ( ALL ( 'Project Factors' ), 'Project Factors'[Year] = cur_year )
RETURN
    SUMX ( tmp, [Factor] * [Sum Qty] )

3. add a table visual with "Projection factors[Year]" field and measure

vbinbinyumsft_1-1675217802263.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
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

1 REPLY 1
v-binbinyu-msft
Community Support
Community Support

Hi @jakechevrier ,

Please try below steps:

1. add a new column to Projection factors table with below dax formula

Sum Qty =
VAR cur_cty = [Category]
VAR tmp =
    FILTER ( ALL ( 'Item' ), 'Item'[Category] = cur_cty )
RETURN
    SUMX ( tmp, [Qty] )

vbinbinyumsft_0-1675217680412.png

 2.  create a measure with below dax formula

Measure =
VAR cur_year =
    SELECTEDVALUE ( 'Project Factors'[Year] )
VAR tmp =
    FILTER ( ALL ( 'Project Factors' ), 'Project Factors'[Year] = cur_year )
RETURN
    SUMX ( tmp, [Factor] * [Sum Qty] )

3. add a table visual with "Projection factors[Year]" field and measure

vbinbinyumsft_1-1675217802263.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.