Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Calculating through unique values

Hi all,    I have the table below. It shows opportunities, quotes, products and values; this is how data is imported in PowerBI. A particularity of the scenario is that an opportunity can have mult...
  • rubayatyasmin's avatar
    3 years ago

    Hi, Anonymous 

     

    Based on the data given, it seems you want to sum the "Quote value" for each distinct "QuoteID" when "Valid" is TRUE. However, the problem you're encountering is that "Quote value" is repeated for each row of the same "QuoteID". This is causing the sum to be much larger than it should be.

    To solve this in Power BI, you can create a measure which first calculates the unique quote values and then sum them up. Here's an example of how you might accomplish this using DAX.

     

    Valid Quote Total = 
    SUMX(
        SUMMARIZE(
            FILTER('YourTable', 'YourTable'[Valid] = TRUE), 
            'YourTable'[QuoteID], 
            "QuoteValue", MAX('YourTable'[Quote value])
        ), 
        [QuoteValue]
    )