Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

multiple conditions + calculation

Hi Community,

 

following problem.

My calculation with multiple conditions including addition does not work

 

 

 

Here is my formula that doesn't work:

 

 If(and( Category ="Küche" && Order >(Date(2021, 12, 31) && Order < (Date(2022, 12, 31), Calculate(0*200) +

 If(and( Category ="Küche" && Shiptment>(Date(2021, 12, 31) && Order < (Date(2022, 12, 31), Calculate(0,25*200) + 

If(and( Category ="Küche" && IBN>(Date(2021, 12, 31) && Order < (Date(2022, 12, 31), Calculate(0,5*200) +

If(and( Category ="Küche" && Ready>(Date(2021, 12, 31) && Order < (Date(2022, 12, 31), Calculate(0,25*200) )))

 

 

 

Does anyone have an idea how I can do this calculation in Power BI?

 

 

 

19 Replies

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi Anonymous ,

     

    Create a column with below code

    Column =
    SWITCH (
        TRUE (),
        Category = "Küche"
            && Order > DATE ( 2021, 12, 31 )
            && Order < DATE ( 2022, 12, 31 ), 0 * 200,
        Category = "Küche"
            && Shiptment > DATE ( 2021, 12, 31 )
            && Order < DATE ( 2022, 12, 31 ), 0.25 * 200,
        Category = "Küche"
            && Shiptment > DATE ( 2021, 12, 31 )
            && Order < DATE ( 2022, 12, 31 ), 0.25 * 200,
        Category = "Küche"
            && IBN > DATE ( 2021, 12, 31 )
            && Order < DATE ( 2022, 12, 31 ), 0.5 * 200,
        Category = "Küche"
            && Ready > DATE ( 2021, 12, 31 )
            && Order < DATE ( 2022, 12, 31 ), 0.25 * 200
    )

     

    and then create a measure like below or directly used new column as summerized as sum

     

    Measure = Sum(table[column])

     

    Thanks,

    Samarth

    • Samarth_18's avatar
      Samarth_18
      Community Champion

      Anonymous  I think you have uploaded it on your office drive and we dont have access to it. Better try to give access to all or use wetranfer.com or similar to it.