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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
raymondchen
Regular Visitor

SUMMARIZECOLUMNS returns blank values

I have a PowerBI dataset with 4 tables. Table 1 contains agent/company information; Table 2 contains product information; Table 3 contains value information, table 4 contains dates information. There are relationships between four tables. However, they are all direct queries. The details cannot be shown in the table view and I cannot access to power query for those four tables neither. I am trying to create a calculated table to pull all the data points that I care into one. I use the below DAX to create the table. However, I notice that it returns many rows with blank or 0 values. I am wondering if there is a way I can modify the DAX to have it return only the value is non blank or greater than 0.

 

NewTable =  
VAR x = YEAR(TODAY())*100 + MONTH(TODAY()) – 1
//get the month id as the most recent one
VAR y = FILTER(‘TABLE 1’, LEFT(‘TABLE 1’[ID], 1) = “A”)
//get the agent id starts with A
VAR z = FILTER(‘TABLE 1’, ‘TABLE 1’[COMPANY NAME] <> “-”)
//get the company name is not “-“
VAR n = FILTER(‘TABLE 2’, ‘TABLE 2’[PRODUCT TYPE] = “ABC” || ‘TABLE 2’[PRODUCT TYPE] = “BCD”)
//get only the product type is “ABC” or “BCD”
RETURN
SUMMARIZECOLUMNS(‘TABLE 1’[ID], ‘TABLE 1’[COMPANY NAME], ‘TABLE 2’[PRODUCT TYPE], y, z, n, “MAXMONTH”, x, “VALUE”, CALCULATE(SUM(‘TABLE 3’[VALUES]), FILTER(‘TABLE 4’[MONTH ID] = x)))

What the DAX returns

raymondchen_0-1699298561989.png

What I hope it will return

raymondchen_1-1699298750546.png

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

First thing I'd try would be IGNORE around the x column.

 

NewTable =
VAR x = YEAR ( TODAY () ) * 100 + MONTH ( TODAY () ) - 1
VAR y = FILTER ( 'TABLE 1', LEFT ( 'TABLE 1'[ID], 1 ) = "A" )
VAR z = FILTER ( 'TABLE 1', 'TABLE 1'[COMPANY NAME] <> "-" )
VAR n =
    FILTER (
        'TABLE 2',
        'TABLE 2'[PRODUCT TYPE] = "ABC"
            || 'TABLE 2'[PRODUCT TYPE] = "BCD"
    )
RETURN
    SUMMARIZECOLUMNS (
        'TABLE 1'[ID],
        'TABLE 1'[COMPANY NAME],
        'TABLE 2'[PRODUCT TYPE],
        y,
        z,
        n,
        "MAXMONTH", IGNORE ( x ),
        "VALUE",
            CALCULATE (
                SUM ( 'TABLE 3'[VALUES] ),
                FILTER ( 'TABLE 4', 'TABLE 4'[MONTH ID] = x )
            )
    )

 

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

First thing I'd try would be IGNORE around the x column.

 

NewTable =
VAR x = YEAR ( TODAY () ) * 100 + MONTH ( TODAY () ) - 1
VAR y = FILTER ( 'TABLE 1', LEFT ( 'TABLE 1'[ID], 1 ) = "A" )
VAR z = FILTER ( 'TABLE 1', 'TABLE 1'[COMPANY NAME] <> "-" )
VAR n =
    FILTER (
        'TABLE 2',
        'TABLE 2'[PRODUCT TYPE] = "ABC"
            || 'TABLE 2'[PRODUCT TYPE] = "BCD"
    )
RETURN
    SUMMARIZECOLUMNS (
        'TABLE 1'[ID],
        'TABLE 1'[COMPANY NAME],
        'TABLE 2'[PRODUCT TYPE],
        y,
        z,
        n,
        "MAXMONTH", IGNORE ( x ),
        "VALUE",
            CALCULATE (
                SUM ( 'TABLE 3'[VALUES] ),
                FILTER ( 'TABLE 4', 'TABLE 4'[MONTH ID] = x )
            )
    )

 

It works. Amazing! Thank you very much.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.