Forum Discussion

Likhitha's avatar
Likhitha
Icon for Helper IV rankHelper IV
6 years ago
Solved

Doubt regarding in calculating difference between sales between weeks from two tables.

Hello All,

I'm having Table-A and Table-B.I'm having Week and Naive Week in two tables and week and naive week are different.

My requirement is if  naive week in Table-B is equal to week in Table-A then calculate difference between sales.

How to do this?Example scenario in the below picture.

 

 

 

 
 
  • Hi Likhitha ,
     
    Based on the sample data you provided, I created a relationship between the two tables with 'week' of table a and 'naive week' of table b.
    You can get the result by creating the following measure:
    difference = IF(MAX('table A'[week])=MAX('table B'[naïve week]),MAX('table B'[sales])-MAX('table A'[sales]))
    For more details,you can refer to the pbix.
     
    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • V-lianl-msft's avatar
    V-lianl-msft
    Icon for Community Support rankCommunity Support
    Hi Likhitha ,
     
    Based on the sample data you provided, I created a relationship between the two tables with 'week' of table a and 'naive week' of table b.
    You can get the result by creating the following measure:
    difference = IF(MAX('table A'[week])=MAX('table B'[naïve week]),MAX('table B'[sales])-MAX('table A'[sales]))
    For more details,you can refer to the pbix.
     
    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.