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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
daxreport
Frequent Visitor

Summing a column from a Virtual table

Hello, 

 

In my measure, I have created a Virtual Table using VAR statement. This virtual table uses ALLSELECTED to summarize all the columns available in the current visual along with two measures that are in the model already. In the second part of thismeasure, I would like to sum Column "A" of the virtual table I created with a filter (based on the current filter context of the matrix). However, when I try to add a SUM function for example, Column A does not even appear as an option. 

 

I have provided my first part of the measure which is a Virtual table. Struggling with the second part where I want to sum Column A based on the current filter context of the visual. Any suggestions on how to write second VAR part where it sums up Column A only for the current filter context? Thanks 

 

VAR INTERNAL_TABLE =
    CALCULATETABLE(ADDCOLUMNS (
        (SUMMARIZE(
            FACTTABLE,FACTTABLE[REGION],FACTTABLE[CUSTOMER])
        "A", [MEASURE 1]
        "B”, [MEASURE 2]
    ),ALLSELECTED())

 

 

2 REPLIES 2
daxreport
Frequent Visitor

Hi @Alf94  Thanks for your response.

 

Unfortunately, it is not working as the SUMX iteration is adding up the entire Calculated Table which is using ALLSELECTED.

 

I need to find a way to use current filter context before SUMX conducts its operation of the calculated table. Thanks 

Alf94
Solution Supplier
Solution Supplier

Hi @daxreport ,

 

Can you please try the following?

 

 

Measure =

SUMX(
    CALCULATETABLE(
        ADDCOLUMNS (
            SUMMARIZE(
                FACTTABLE,
                FACTTABLE[REGION],
                FACTTABLE[CUSTOMER]
            )
            "A", [MEASURE 1]
            "B”, [MEASURE 2]
            ),
        ALLSELECTED()
    ),
    [A]
)

 

 

If I answered your question, please mark my post as a solution.

 

Best,

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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