Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
Anonymous
Not applicable

SummarizeColumns() may not be used in this context

 

Hi Everyone, I'm trying to check if a customer code is found within a list of customers, I've created the list of customers using the following sytanx and it's working fine, the only issue I'm facing when I call the table within a calclated column.

 

This method works:

 

 

Growth Status = 
IF (
    'Customers'[Customer code]
        in table
,"Positive Growth",BLANK())

 

 

 

table = CALCULATETABLE (
    VALUES ( 'sales'[Customer code] ),
    FILTER (
        SUMMARIZECOLUMNS(
            'sales'[Customer code],
            FILTER (
                'Calendar',
                'Calendar'[Year] = YEAR ( TODAY () )
            ),
            "YTD Growth", [% YTD Sales Vs. LY YTD Sales]
        ),
        [YTD Growth] > 0
    )
)

 

 

 

This method returns an errror "SummarizeColumns() may not be used in this context."

 

 

Growth Status = 
IF (
    'Customers'[Customer code]

        in 

CALCULATETABLE (
    VALUES ( 'sales'[Customer code] ),
    FILTER (
        SUMMARIZECOLUMNS(
            'sales'[Customer code],
            FILTER (
                'Calendar',
                'Calendar'[Year] = YEAR ( TODAY () )
            ),
            "YTD Growth", [% YTD Sales Vs. LY YTD Sales]
        ),
        [YTD Growth] > 0
    )
)

,"Positive Growth",BLANK())

 

 

I'm trying to use the second method as first method is not sufficient in the long run.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

 

I managed to work it out with the following dax syntax, changed the summarizecolumns function to addcolumns function in conjunction with summrize function:

 

 

 

Growth Status = 
IF (
    'Customers'[Customer code]
        IN CALCULATETABLE (
            VALUES ( 'sales'[Customer code] ),
            FILTER (
                CALCULATETABLE (
                    ADDCOLUMNS (
                        SUMMARIZE ( 'sales', 'sales'[Customer code] ),
                        "YTD", CALCULATE ( [% YTD Sales Vs. LY YTD Sales] )
                    ),
                    FILTER (
                        'Calendar',
                        'Calendar'[Year] = YEAR ( TODAY () )          
                    )
                ),
                [YTD] > 0
            )
        ),
    "Positive Growth",BLANK())

 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

 

I managed to work it out with the following dax syntax, changed the summarizecolumns function to addcolumns function in conjunction with summrize function:

 

 

 

Growth Status = 
IF (
    'Customers'[Customer code]
        IN CALCULATETABLE (
            VALUES ( 'sales'[Customer code] ),
            FILTER (
                CALCULATETABLE (
                    ADDCOLUMNS (
                        SUMMARIZE ( 'sales', 'sales'[Customer code] ),
                        "YTD", CALCULATE ( [% YTD Sales Vs. LY YTD Sales] )
                    ),
                    FILTER (
                        'Calendar',
                        'Calendar'[Year] = YEAR ( TODAY () )          
                    )
                ),
                [YTD] > 0
            )
        ),
    "Positive Growth",BLANK())

 

 

selimovd
Super User
Super User

Hey @Anonymous ,

 

you can get the values that are in both tables with the INTERSECT function and VALUES:

MyIntersectTable =
INTERSECT (
    VALUES ( 'Customers'[Customer code] ),
    VALUES ( 'sales'[Customer code] )
)

 

Let me know if that works. If you need any help please let me know.

If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
Anonymous
Not applicable

My issue is not with the intersection, it's with the summrizecolumn function

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.