Forum Discussion

Robert14358's avatar
Robert14358
Icon for Resolver III rankResolver III
3 years ago
Solved

CALCULATETABLE with GROUPBY

Hello all.

 

im trying to use CALCULATETABLE with GROUPBY and im running into issues.

i need to use CALCULATETABLE because im using USERELATIONSHIP, but GROUPBY doesn't seems to accept CALCULTATETABLE as a proper source.

 

is there anyway to to use CALCULATETABLE with GROUPBY.

 

Thank you

  • Robert14358's avatar
    Robert14358
    3 years ago

    Chat GPT was able to help, ๐Ÿ™‚

    This was the syntax I needed:

    EXPORT =
    VAR VARTABLE =
        CALCULATETABLE(
            GROUPBY(),
            USERELATIONSHIP(),
        )
    RETURN
        VARTABLE

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Robert14358 I don't see any issue using CALCULATETABLE with GROUPBY. For example, this works in my test scenario:

    Table = 
        GROUPBY(
            CALCULATETABLE( 'Product Inventory', 'Product Inventory'[ProductKey] = 167),
            [ProductKey],
            "Sum", SUMx( CURRENTGROUP(), [UnitCost] )
        )
    • Robert14358's avatar
      Robert14358
      Icon for Resolver III rankResolver III

      Chat GPT was able to help, ๐Ÿ™‚

      This was the syntax I needed:

      EXPORT =
      VAR VARTABLE =
          CALCULATETABLE(
              GROUPBY(),
              USERELATIONSHIP(),
          )
      RETURN
          VARTABLE
      • Greg_Deckler's avatar
        Greg_Deckler
        Icon for Community Champion rankCommunity Champion

        Robert14358 Sorry, had it reversed. Yes, CALCULATETABLE, should be able to take any table expression as a first parameter, including GROUPBY (which returns a table).