Forum Discussion

PKPK90's avatar
PKPK90
Icon for Helper I rankHelper I
3 years ago

Totals from SummarizeColumns

Hi, I have created new table 

SupplyDemandPerSiteItem =
SUMMARIZECOLUMNS(
    DistinctTable[Site],
    DistinctTable[ItemKey],
    "Demand",MAX(DistinctTable[RunningRequirement]),
    "Supply",MAX(DistinctTable[RunningReception]))
 
from this table I want to get
SupplyDemandPerItem=
SUMMARIZECOLUMNS(
   SupplyDemand[ItemKey],
  "Demand",SUM(Demand),
  "Supply",SUM(Supply))
 
Is it possible to to achieve the same result but in the first table?
I don't want to create two tables if it's not necessary.

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi PKPK90 ,

     

    Please try:

    SupplyDemandPerItem =
    SUMMARIZECOLUMNS(
        DistinctTable[ItemKey],
        "Demand", SUMX(SUMMARIZECOLUMNS(
            DistinctTable[Site],
            DistinctTable[ItemKey],
            "Demand", MAX(DistinctTable[RunningRequirement])
        ), [Demand]),
        "Supply", SUMX(SUMMARIZECOLUMNS(
            DistinctTable[Site],
            DistinctTable[ItemKey],
            "Supply", MAX(DistinctTable[RunningReception])
        ), [Supply])
    )

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

    • PKPK90's avatar
      PKPK90
      Icon for Helper I rankHelper I

      Thanks, I am receiving error message like:

      SummarizeColumns() and AddMissingItems() may not be used in this context.

  • Check this one
    SupplyDemandPerItem =
    VAR DemandTable =
    SUMMARIZE(
    DistinctTable,
    DistinctTable[Site],
    DistinctTable[ItemKey],
    "Demand", MAX(DistinctTable[RunningRequirement])
    )
    VAR SupplyTable =
    SUMMARIZE(
    DistinctTable,
    DistinctTable[Site],
    DistinctTable[ItemKey],
    "Supply", MAX(DistinctTable[RunningReception])
    )
    RETURN
    SUMMARIZECOLUMNS(
    DistinctTable[ItemKey],
    "Demand", SUMX(DemandTable, [Demand]),
    "Supply", SUMX(SupplyTable, [Supply])
    )

    • PKPK90's avatar
      PKPK90
      Icon for Helper I rankHelper I

      Hi, I am receiving the same values for every Item.