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
Yaro
Frequent Visitor

Summarize doesnt work on var table

Hi.
Please help me with following.
I have multiple tables (2 as example) from direct Power BI query - I need to consolidate them.
So my idea is to select data I need, UNION it and then summarize it by selected dimensions.
It works good with SUM, but I need to DISTINCTCOUNT one column and it doesnt accept it as reference.
I think it is taking it as measure, please suggest how to fix it?
Thank you!

Consolidated =

var Calls =  
        SELECTCOLUMNS(CallsRawSharePoint,
        "Site",                     "Global",
        "CalDate",                  related('Calendar'[Date].[Date]),
        "CallIDString",             0,
        "CallsForecasted",          0,
        "CallsOffered",             sum(CallsRawSharePoint[Total Offered Calls]),
        "CallsAnswered",            sum(CallsRawSharePoint[Total Answered Calls]),                  
        "CallsAnsweredSL",          sum(CallsRawSharePoint[Answered In SL]),
        "CallsAbandonedSL",         sum(CallsRawSharePoint[Abandoned In SL]),
        "NonCrit Score",            0,
        "QA Customer Critical",     0,
        "QA BusinessCrit Score",    0,              
        "ComplCrit Score",          0
)

var Quality =
        SELECTCOLUMNS(QA,
        "Site",                 related('Global Master List'[Global Site]),
        "CalDate",              related('Calendar'[Date].[Date]),
        "CallIDString",        [Call ID String],
        "CallsForecasted",      0,
        "CallsOffered",         0,
        "CallsAnswered",        0,                  
        "CallsAnsweredSL",      0,
        "CallsAbandonedSL",     0,
        "NonCrit Score",        [NonCrit Score %],
        "QA Customer Critical", [QA Customer Critical %] ,
        "QA BusinessCrit Score",[QA Business Critical %] ,              
        "ComplCrit Score",      [ComplCrit Score %]
)

var UnitedTable = union(Calls,Quality)

return SUMMARIZE(UnitedTable,
                [Site],
                [CalDate],
                "CallsOffered",     sum([CallsOffered]),
                "CallsAnswered"     sum([CallsAnswered]),
                "Monitorings Num",  DISTINCTCOUNT(CallIDString)
                )

 Last row doesnt work.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Yaro , Try group by in this case

 

Check the Dax solution

https://medium.com/@amitchandak/power-bi-power-query-vs-dax-append-and-summarize-data-233f173d0839

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Yaro , Try group by in this case

 

Check the Dax solution

https://medium.com/@amitchandak/power-bi-power-query-vs-dax-append-and-summarize-data-233f173d0839

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

hi @amitchandak 
got stuck again
it works like a charm when there is one measure to be summarized
but when I am adding additional column to be summarized it gives me an error

return groupby(UnitedTable2, [Site], 
                            [CalDate], 
                            "MonitoringsNum",COUNTX(CURRENTGROUP(),[CallIDString]),
                            "ComplCriticalScore",SUMX(CURRENTGROUP(),[ComplCrit Score %])
              )

It workins perfectly fine with COUNTX but SUMX gives an error 
"The CALCULATE function cannot be used in an expression argument for the GROUPBY function"

 

Please suggest.
Thank you

thank you @amitchandak 
I need distinctcount, so it worked with a bit of workaround

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.