Forum Discussion

SureshPydi1's avatar
SureshPydi1
Frequent Visitor
3 years ago
Solved

Need Help on Sum of Distinct Columns

Hi Team, I need help on Distinct Columns in a table using Measure.   Here is my Query.  My Table is as follows. We need to get the Distinact Values from all the rows of a table and get Some of one...
  • Greg_Deckler's avatar
    3 years ago

    SureshPydi1 So like this?

    Measure = 
      VAR __Table = 
        SUMMARIZE(
          'Table',
          [Supplier], [Category], [Street Address], [City], [State], [Latitude], [Longitude],
          "__FSAmount", SUM([Feedstock Amount])
        )
      VAR __Result = COUNTROWS(DISTINCT(__Table))
    RETURN
      __Result
  • SureshPydi1's avatar
    3 years ago

    Hi Greg_Deckler ,

     

    Thanks Somuch for your help. I have changed the logic and i am able to achive the requirement.

     

    Here is the updated query

    In the code i have updated the filter and updated the Sum to Max to get the Sum of the column.

    Measure=
    VAR __Table =
    Filter(SUMMARIZE(
    'SupplierByFarmRadius',
    [Supplier],[Category],[StreetAddress],[City],[State],[AddressTypeID],
    "__FSAmount", MAX([FS_Amount])
    ),SupplierByFarmRadius[AddressTypeID]<>1)
    VAR __Result = SumX(DISTINCT(__Table),[__FSAmount])
    RETURN
    __Result