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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
stribor45
Post Prodigy
Post Prodigy

How to summarize virtual table table

I am trying to summarize this virtual table (non base table) and of course I am getting error that the base table is expected. Can someone assist please.

 

DEFINE
    VAR C =
        ADDCOLUMNS (
            DISTINCT (
                UNION (
                    DISTINCT ( 'A'[ID] ),
                    DISTINCT ( 'B'[ID] )
                )
            ),
            "@COUNTRY",
                MINX (
                    FILTER (
                        ADDRESS,
                        ADRESS[USERID] = FORMAT ( [ID], "0" )
                    ),
                    RELATED ( 'Flags'[Country] )
                )
        )

EVALUATE
SUMMARIZE (
    C,
    C[Country],
    "Count", COUNT ( C[ID] )
)
1 ACCEPTED SOLUTION

@stribor45 

Missed the @ sign 😅

DEFINE
    VAR C =
        ADDCOLUMNS (
            DISTINCT ( UNION ( DISTINCT ( 'A'[ID] ), DISTINCT ( 'B'[ID] ) ) ),
            "@COUNTRY",
                MINX (
                    FILTER ( ADDRESS, ADRESS[USERID] = FORMAT ( [ID], "0" ) ),
                    RELATED ( 'Flags'[Country] )
                )
        )

EVALUATE
GROUPBY ( C, [@Country], "Count", SUMX ( CURRENTGROUP (), 1 ) )

View solution in original post

6 REPLIES 6
v-nmadadi-msft
Community Support
Community Support

Hi @stribor45 ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

 

tamerj1
Super User
Super User

Hi @stribor45 

please try

DEFINE
    VAR C =
        ADDCOLUMNS (
            DISTINCT ( UNION ( DISTINCT ( 'A'[ID] ), DISTINCT ( 'B'[ID] ) ) ),
            "@COUNTRY",
                MINX (
                    FILTER ( ADDRESS, ADRESS[USERID] = FORMAT ( [ID], "0" ) ),
                    RELATED ( 'Flags'[Country] )
                )
        )

EVALUATE
GROUPBY ( C, [Country], "Count", SUMX ( CURRENTGROUP (), 1 ) )

I tried it and error received was COUNTRY specified in the GROUPBY function was not found in the table

@stribor45 

Missed the @ sign 😅

DEFINE
    VAR C =
        ADDCOLUMNS (
            DISTINCT ( UNION ( DISTINCT ( 'A'[ID] ), DISTINCT ( 'B'[ID] ) ) ),
            "@COUNTRY",
                MINX (
                    FILTER ( ADDRESS, ADRESS[USERID] = FORMAT ( [ID], "0" ) ),
                    RELATED ( 'Flags'[Country] )
                )
        )

EVALUATE
GROUPBY ( C, [@Country], "Count", SUMX ( CURRENTGROUP (), 1 ) )
gmsamborn
Super User
Super User

Hi @stribor45 

 

Without sample data, this is just a guess:

EVALUATE
    SUMMARIZE(
        ADDCOLUMNS (
            DISTINCT (
                UNION (
                    DISTINCT ( 'A'[ID] ),
                    DISTINCT ( 'B'[ID] )
                )
            ),
            "@COUNTRY",
                MINX (
                    FILTER (
                        ADDRESS,
                        ADRESS[USERID] = FORMAT ( [ID], "0" )
                    ),
                    RELATED ( 'Flags'[Country] )
                )
        ),
        [Country],
        "Count", COUNT ( [ID] )
    )

 

If that doesn't help, could please supply sample data to work with?

 

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

I know without data is hard. I tried that before I posted as I was pretty sure it will work but kept complaining that it cant find [ID]

stribor45_0-1745661902326.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.