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

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

Reply
Anonymous
Not applicable

Compare Column with column of different table row by row according to dates

Hi All,

 

I have 2 tables one summary table  and other detailed table with historical data.

Table 1:-  

Data.PNG

 

 Table 2:-

Calc.PNG

 

Table 2 has data for last 5 months.

 

I need to calculate Days in Table 1 using columns of Table 2:-

=IFERROR(IF(Inv<=Dec,Inv/Dec*31,IF(Inv<=(Dec+Nov),(Inv-Dec)/Nov*30+31,IF(Inv<=(Dec+Nov+Oct),(Inv-Dec-Nov)/Oct*31+31+30,IF(Inv<=(Dec+Nov+Oct+Sep),(Inv-Dec-Nov-Oct)/Sep*30+31+30+31,IF(Inv<=(Dec+Nov+Oct+Sep+Aug),(Inv-Dec-Nov-Oct-Sep)/Aug*31+31+30+31+30))),0)

 

Basically what formula does is, for a particular Code and a particular Month -  Inv should be compared with its previous months data,

In excel it is simple as i can pivot the table use RC reference formula, but here it should be dynamic.

For Month 01/2020 -  it will consider - Dec,Nov, Oct, Sep, Aug

For mont 02/2020 -Jan,Dec,Nov, Oct, Sep in the same formula above.

 

I tried using variables but due to the dates in same column, i am not getting the desired result.

 

Please help with this dynamic formula

Any help appreciated.

1 REPLY 1
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

I can understand the connection between your two tables, but I don’t quite understand what you want to calculate.

Maybe you can use a table to list the results you want to get.

ff9.PNG

 

Best regards,
Lionel Chen

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.