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
cmc910514
Frequent Visitor

Divide a value by a value in another table from next period

Hi community,

 

Let me show the example directly in the picture below...

 

How can I create a measure to divide 2,119 (E3) by 840 (D4) * 7? (7 days a week)

 

Under the picture, you can find the measure for stock projection. Really appreciate if anyone can help!

 

cmc910514_0-1693220478992.png

Stock Projection = 
    CALCULATE(
        SUM(Stock[qty]) + SUM(Supply[supply_qty]) - SUM('Demand'[demand_qty]),
        ALLSELECTED('Calendar'[Date_]),
        ISONORAFTER('Calendar'[Date_], MAX('Calendar'[Date_]), DESC) 
             )

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @cmc910514 ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a calculated column in Table [Demand].

Index = RANKX('Demand','Demand'[Date],,ASC,Dense)

(3) We can create a measure.

Stock days = 
var _a=CALCULATE(MAX('Demand'[Demand]),FILTER(ALLSELECTED('Demand'),'Demand'[Index]=MAX('Demand'[Index])+1))
return DIVIDE([Stock Projection],_a)*7

(4) Then the result is as follows.

vtangjiemsft_0-1693363381169.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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
Anonymous
Not applicable

Hi @cmc910514 ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a calculated column in Table [Demand].

Index = RANKX('Demand','Demand'[Date],,ASC,Dense)

(3) We can create a measure.

Stock days = 
var _a=CALCULATE(MAX('Demand'[Demand]),FILTER(ALLSELECTED('Demand'),'Demand'[Index]=MAX('Demand'[Index])+1))
return DIVIDE([Stock Projection],_a)*7

(4) Then the result is as follows.

vtangjiemsft_0-1693363381169.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

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.