Forum Discussion

SWAL's avatar
SWAL
New Member
4 years ago
Solved

Value based on filter DAX

Dear all

 

Thank you for the great work in this Forum. I have learned the ins and out of BI.

 

I have a problem with calculation a date based on a "Product Name" in dax and don't seem to be find a solution. I have tried IF, SUM, SUMX and Filter, Calculate etc an cannot hack this one to be repatative. So, Please help me to see where I am going wrong . . . here is an example of what I am looking for

 

Product NameDateFuture Calculated Date

Orange  

04/01/2022  (+15)(=) 04/15/2022

Apple

04/01/2022  (+10)(=) 04/10/2022

Orange

04/01/2022  (+15)(=) 04/15/2022
Pear04/01/2022  (+5) etc(=) 04/05/2022

 

Basically I need to Define the "Product Name" then Calculate the "Date" to a "Future Calculated Date" to be displayed in a Table in Power BI Repetatively

 

Thank you in advance and Kind Regards

  • Hi All

     

    I have manager to resolve the problem  as follows:

     

    Measure =
    IF(MAX('Product'[Product Name])="Orange",'Data'[ProdDate]+15,
    IF(MAX('Product'[Product Name])="Audio",'Data'[ProdDate]+10,
    IF(MAX('Product'[Product Name])="Awake!",'Data'[ProdDate]+5)))
     
    How this will be useful
     
     

2 Replies

  • SWAL's avatar
    SWAL
    New Member

    Turns this but it has a glitsh in that only uses the first VALUE

     

    Measure = CALCULATE(
    SWITCH(FALSE(),
    VALUES('Product'[Product Name]) = "Orange", sum('Product'[Date]) +15,
    VALUES('Product'[Product Name]) = "Apple", sum('Product'[Date]) +10 ))
  • SWAL's avatar
    SWAL
    New Member

    Hi All

     

    I have manager to resolve the problem  as follows:

     

    Measure =
    IF(MAX('Product'[Product Name])="Orange",'Data'[ProdDate]+15,
    IF(MAX('Product'[Product Name])="Audio",'Data'[ProdDate]+10,
    IF(MAX('Product'[Product Name])="Awake!",'Data'[ProdDate]+5)))
     
    How this will be useful