Forum Discussion

Fxelixe's avatar
Fxelixe
Frequent Visitor
3 years ago
Solved

Re:

Hi   So i have trouble to create logic to solve package issue. the goal is to put remark when customer buy our package which consist of several products   if customer didn't buy the specific pro...
  • Jihwan_Kim's avatar
    3 years ago

    Hi,

    I am not sure how your datamodel looks like, but please check the below picture and the attached pbix file.

    It is for creating a measure.

    I hope the below can provide some ideas on how to create a solution for your datamodel.

     

     

     

    Expected output: =
    VAR _productAcondition =
        CALCULATE ( SUM ( Data[Quantity] ), Package[Product Name] = "Product A" ) <> 0
    VAR _productBcondition =
        CALCULATE ( SUM ( Data[Quantity] ), Package[Product Name] = "Product B" ) <> 0
    VAR _productCcondition =
        CALCULATE ( SUM ( Data[Quantity] ), Package[Product Name] = "Product C" ) <> 0
    VAR _productDcondition =
        CALCULATE ( SUM ( Data[Quantity] ), Package[Product Name] = "Product D" ) <> 0
    RETURN
        IF (
            HASONEVALUE ( User[User] ),
            _productAcondition * _productBcondition * _productCcondition * _productDcondition
        )
    

     

     

  • Fxelixe's avatar
    3 years ago

    Update:

    Already have the answer but kinda complicated.

    the idea is to create multiple var to count the products
    and then return it using floor
    return
    floor(item(1)+item(2)+....+Item(n),n)/n


  • Jihwan_Kim's avatar
    Jihwan_Kim
    3 years ago

    Hi,

    Thank you for your message, and please check the below picture and the attached pbix file.

    I tried to create a sample pbix file like below.