Forum Discussion

amikm's avatar
amikm
Icon for Helper V rankHelper V
3 years ago
Solved

Calculate the ratio based on two disconnected table

Hi all,  I need some suggestion, I got stuck for below usecase this report is to compare the R12 and R6Sales between two products and then compare the ratio between R12Sales and R6Sal...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  amikm ,

     

    You can try to add Index to both productA and productB tables, so that each row can have [Index] to act as a flag to compare, otherwise the comparison would be the total value of the two tables.

     

    Here are the steps you can follow:

    1. In Power Query -- Add Column – Index Column – From 1.

    2. Create measure.

    Measure_R16=
    var _AR16=
    SUMX(
        FILTER(ALL(ProductA),
        'ProductA'[Index]=MAX('ProductA'[Index])),[R16 Sales])
    var _BR16=
    SUMX(
        FILTER(ALL(ProductB),
       'ProductB'[Index]=MAX('ProductA'[Index])),[R16 Sales])
    return
    DIVIDE(_BR16,_AR16)
    Measure_R6 =
    var _AR6=
    SUMX(
        FILTER(ALL(ProductA),
       'ProductA'[Index]=MAX('ProductA'[Index])),[R6 Sales])
    var _BR6=
    SUMX(
        FILTER(ALL(ProductB),
       'ProductB'[Index]=MAX('ProductB'[Index])),[R6 Sales])
    return
    DIVIDE(_BR6,_AR6)

    3. Result:

    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