EPC Group - Enterprise Microsoft AI, SharePoint, Power BI, and Azure Consulting
G2 High Performer Summer 2025, Momentum Leader Spring 2025, Leader Winter 2025, Leader Spring 2026
BlogContact
Ready to transform your Microsoft environment?Get started today
(888) 381-9725Get Free Consultation
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌
‌

EPC Group

Enterprise Microsoft consulting with 29 years serving Fortune 500 companies.

(888) 381-9725
contact@epcgroup.net
4900 Woodway Drive - Suite 830
Houston, TX 77056

Follow Us

Solutions

  • All Services
  • Microsoft 365 Consulting
  • AI Governance
  • Azure AI Consulting
  • Cloud Migration
  • Microsoft Copilot
  • Data Governance
  • Microsoft Fabric
  • vCIO / vCAIO Services
  • Large-Scale Migrations
  • SharePoint Development

Industries

  • All Industries
  • Healthcare IT
  • Financial Services
  • Government
  • Education
  • Teams vs Slack

Power BI

  • Case Studies
  • 24/7 Emergency Support
  • Dashboard Guide
  • Gateway Setup
  • Premium Features
  • Lookup Functions
  • Power Pivot vs BI
  • Treemaps Guide
  • Dataverse
  • Power BI Consulting

Company

  • About Us
  • Our History
  • Microsoft Gold Partner
  • Case Studies
  • Testimonials
  • Blog
  • Resources
  • All Guides & Articles
  • Video Library
  • Client Reviews
  • Contact
  • Schedule a consultation

Microsoft Teams

  • Teams Questions
  • Teams Healthcare
  • Task Management
  • PSTN Calling
  • Enable Dial Pad

Azure & SharePoint

  • Azure Databricks
  • Azure DevOps
  • Azure Synapse
  • SharePoint MySites
  • SharePoint ECM
  • SharePoint vs M-Files

Comparisons

  • M365 vs Google
  • Databricks vs Dataproc
  • Dynamics vs SAP
  • Intune vs SCCM
  • Power BI vs MicroStrategy

Legal

  • Sitemap
  • Privacy Policy
  • Terms
  • Cookies

About EPC Group

EPC Group is a Microsoft consulting firm founded in 1997 (originally Enterprise Project Consulting, renamed EPC Group in 2005). 29 years of enterprise Microsoft consulting experience. Microsoft Gold Partner from 2003–2022 — the oldest Microsoft Gold Partner in North America — and currently a Microsoft Solutions Partner with six designations: Data & AI, Modern Work, Infrastructure, Security, Digital & App Innovation, and Business Applications.

Headquartered at 4900 Woodway Drive, Suite 830, Houston, TX 77056. Public clients include NASA, FBI, Federal Reserve, Pentagon, United Airlines, PepsiCo, Nike, and Northrop Grumman. 6,500+ SharePoint implementations, 1,500+ Power BI deployments, 500+ Microsoft Fabric implementations, 70+ Fortune 500 organizations served, 11,000+ enterprise engagements, 200+ Microsoft Power BI and Microsoft 365 consultants on staff.

About Errin O'Connor

Errin O'Connor is the Founder, CEO, and Chief AI Architect of EPC Group. Microsoft MVP for multiple years starting 2002–2003. 4× Microsoft Press bestselling author of Windows SharePoint Services 3.0 Inside Out (MS Press 2007), Microsoft SharePoint Foundation 2010 Inside Out (MS Press 2011), SharePoint 2013 Field Guide (Sams/Pearson 2014), and Microsoft Power BI Dashboards Step by Step (MS Press 2018).

Original SharePoint Beta Team member (Project Tahoe). Original Power BI Beta Team member (Project Crescent). FedRAMP framework contributor. Worked with U.S. CIO Vivek Kundra on the Obama administration's 25-Point Plan to reform federal IT, and with NASA CIO Chris Kemp as Lead Architect on the NASA Nebula Cloud project. Speaker at Microsoft Ignite, SharePoint Conference, KMWorld, and DATAVERSITY.

© 2026 EPC Group. All rights reserved. Microsoft, SharePoint, Power BI, Azure, Microsoft 365, Microsoft Copilot, Microsoft Fabric, and Microsoft Dynamics 365 are trademarks of the Microsoft group of companies.

Back to Blog

Power BI GROUPBY Function Guide

Errin O\'Connor
December 2025
8 min read

The GROUPBY function in DAX creates a summary table by grouping rows from a source table and applying aggregation expressions using the CURRENTGROUP() function. Unlike SUMMARIZE, GROUPBY operates at the row level without context transitions, making it a precise tool for scenarios requiring explicit control over aggregation behavior in Power BI models.

GROUPBY Syntax and Parameters

GROUPBY returns a table with grouped columns and aggregated values. The key distinction is that aggregation expressions must use CURRENTGROUP() rather than standard CALCULATE-based measures.

GROUPBY (
    <Table>,
    [<GroupBy_ColumnName1>],
    [<GroupBy_ColumnName2>],
    [<Name>], [<Expression>],
    ...
)

-- Example: Group sales by region with total amount
EVALUATE
GROUPBY (
    Sales,
    Sales[Region],
    "Total Sales", SUMX ( CURRENTGROUP (), Sales[Amount] ),
    "Order Count", COUNTX ( CURRENTGROUP (), Sales[OrderID] )
)
  • Table – The source table to group. Can be a physical table, calculated table, or table expression.
  • GroupBy columns – One or more columns to group by. These columns define the granularity of the output table.
  • Name/Expression pairs – New column names and their aggregation expressions. Expressions MUST use CURRENTGROUP() as the iterator table.
  • CURRENTGROUP() – A special function that returns the set of rows in the current group, used exclusively within GROUPBY aggregation expressions.

GROUPBY vs SUMMARIZE: Key Differences

GROUPBY and SUMMARIZE both create summary tables, but they differ fundamentally in how they evaluate aggregation expressions. Understanding these differences is critical for writing correct and performant DAX.

  • Context transitions – SUMMARIZE performs context transitions when evaluating expressions, which can produce unexpected results with measures. GROUPBY does NOT perform context transitions.
  • CURRENTGROUP vs measures – GROUPBY requires CURRENTGROUP() in aggregation expressions. SUMMARIZE allows referencing measures directly but is prone to errors due to implicit context transitions.
  • Related table grouping – SUMMARIZE can group by columns from related tables. GROUPBY can only group by columns from the base table or columns already present in the table expression.
  • Microsoft recommendation – Microsoft recommends using SUMMARIZECOLUMNS for new development, GROUPBY for explicit row-level aggregation, and avoiding SUMMARIZE with expressions.
-- SUMMARIZE (avoid using expressions directly)
EVALUATE
SUMMARIZE (
    Sales,
    Sales[Region],
    "Total", SUM ( Sales[Amount] )  -- Works but uses context transition
)

-- GROUPBY (explicit, no context transition)
EVALUATE
GROUPBY (
    Sales,
    Sales[Region],
    "Total", SUMX ( CURRENTGROUP (), Sales[Amount] )
)

-- SUMMARIZECOLUMNS (recommended for most scenarios)
EVALUATE
SUMMARIZECOLUMNS (
    Sales[Region],
    "Total", SUM ( Sales[Amount] )
)

Practical GROUPBY Examples

GROUPBY excels in scenarios where you need precise control over aggregation logic, particularly when working with complex expressions that could produce incorrect results with SUMMARIZE's implicit context transitions.

-- Average order value by customer segment
EVALUATE
GROUPBY (
    Sales,
    Sales[CustomerSegment],
    "Avg Order Value", AVERAGEX ( CURRENTGROUP (), Sales[Amount] ),
    "Max Order", MAXX ( CURRENTGROUP (), Sales[Amount] ),
    "Min Order", MINX ( CURRENTGROUP (), Sales[Amount] ),
    "Distinct Products", COUNTX (
        DISTINCT ( SELECTCOLUMNS ( CURRENTGROUP (), "P", Sales[ProductID] ) ),
        [P]
    )
)

-- Weighted average price by category
EVALUATE
GROUPBY (
    Products,
    Products[Category],
    "Weighted Avg Price", DIVX (
        SUMX ( CURRENTGROUP (), Products[Price] * Products[UnitsSold] ),
        SUMX ( CURRENTGROUP (), Products[UnitsSold] )
    )
)
  • Multi-aggregation – Calculate SUM, AVERAGE, MIN, MAX, and COUNT in a single GROUPBY call for comprehensive summaries
  • Weighted averages – CURRENTGROUP makes it straightforward to compute weighted calculations within each group
  • Distinct counts within groups – Count unique values within each group using DISTINCT + SELECTCOLUMNS over CURRENTGROUP()
  • Conditional aggregation – Use IF or FILTER within CURRENTGROUP() expressions to aggregate only rows meeting specific conditions

Performance Optimization for GROUPBY

GROUPBY performance depends on the source table size and the complexity of aggregation expressions. These optimization techniques ensure your GROUPBY queries remain responsive in enterprise-scale models.

  • Pre-filter the source table – Use FILTER or CALCULATETABLE to reduce the row count before passing to GROUPBY
  • Limit grouping columns – Each additional grouping column increases the number of output rows and processing time
  • Avoid nested GROUPBY – Do not nest GROUPBY inside another GROUPBY; use a single call with all required grouping columns
  • Use in calculated tables – GROUPBY is most commonly used in EVALUATE queries (DAX Studio) or calculated tables, not in measures
  • Consider SUMMARIZECOLUMNS – For standard aggregation scenarios, SUMMARIZECOLUMNS is typically faster than GROUPBY due to engine optimizations

Why Choose EPC Group for Power BI DAX Expertise

EPC Group's DAX specialists have optimized enterprise Power BI models for 29 years as a Microsoft Gold Partner. Our founder, Errin O'Connor, authored 4 bestselling Microsoft Press books including the definitive Power BI guide. We bring deep expertise in advanced DAX patterns including GROUPBY, SUMMARIZECOLUMNS, and custom aggregation logic for Fortune 500 organizations where data accuracy and query performance are mission-critical.

Need Advanced DAX Development for Your Power BI Models?

EPC Group's certified Power BI consultants specialize in building enterprise-grade DAX models with optimized aggregation patterns for accurate, high-performance reporting.

Schedule a ConsultationCall (888) 381-9725

Frequently Asked Questions

Can I use GROUPBY in a measure?

Technically, you can use GROUPBY inside a measure as part of a table expression (e.g., inside COUNTROWS or MAXX), but it is not common practice. GROUPBY is primarily used in EVALUATE queries for ad-hoc analysis in DAX Studio, in calculated tables for persisted aggregations, or as an intermediate table expression within ADDCOLUMNS, FILTER, or SUMX. For measure-based aggregation, SUMMARIZECOLUMNS or CALCULATE with appropriate filter modifications are more appropriate.

What is CURRENTGROUP and where can I use it?

CURRENTGROUP() is a special DAX function that can ONLY be used inside GROUPBY aggregation expressions. It returns a table containing the rows belonging to the current group being evaluated. Think of it as an automatic FILTER that gives you access to just the rows in each group. It cannot be used in measures, calculated columns, or any other DAX context outside of GROUPBY's expression arguments.

Should I use GROUPBY or SUMMARIZECOLUMNS?

Use SUMMARIZECOLUMNS for most scenarios — it is the recommended function for creating summary tables and is highly optimized by the DAX engine. Use GROUPBY when you need explicit control over row-level aggregation without context transitions, such as weighted averages, conditional row-level logic, or when SUMMARIZE produces incorrect results. GROUPBY is the more specialized tool; SUMMARIZECOLUMNS is the general-purpose workhorse.

Can GROUPBY group by columns from related tables?

No. Unlike SUMMARIZE, GROUPBY cannot directly group by columns from related tables. You must first expand the source table to include the related columns using ADDCOLUMNS or NATURALLEFTOUTERJOIN, then pass that expanded table to GROUPBY. Alternatively, use SUMMARIZECOLUMNS which natively supports grouping by columns from any table in the model, making it more flexible for cross-table aggregation scenarios.

Why does GROUPBY sometimes return different results than SUMMARIZE?

The difference stems from context transitions. SUMMARIZE evaluates expression arguments in a filter context with automatic context transitions, meaning measures and CALCULATE are affected by the current row context. GROUPBY evaluates expressions at the row level using CURRENTGROUP() without context transitions. This means GROUPBY always produces deterministic aggregations over the physical rows in each group, while SUMMARIZE may produce unexpected results when measures interact with the evaluation context. This is the primary reason Microsoft recommends avoiding extension columns in SUMMARIZE.

Related Resources

Continue exploring power bi insights and services

power bi

6 Reasons to Use Power Automate in Power BI

power bi

Ad Hoc Reporting

power bi

Add New Data in Power BI

power bi

Agriculture Power BI Consulting

Explore All Services

Why Organizations Choose EPC Group

EPC Group is a Houston-based Microsoft consulting firm with 29 years of enterprise implementation experience and over 10,000 successful deployments across Power BI, Microsoft Fabric, SharePoint, Azure, Microsoft 365, and Copilot. We serve organizations across all industries including Fortune 500, federal agencies, healthcare, financial services, government, manufacturing, energy, education, retail, technology, and global enterprises.

What sets EPC Group apart is our governance-first approach. Every engagement begins with a security and compliance assessment. Our team of senior architects brings hands-on delivery experience across HIPAA, SOC 2, FedRAMP, and CMMC environments. We own outcomes, not hours.

  • Fixed-fee accelerators with predictable pricing and defined deliverables
  • Senior architect engagement on every project, not rotating juniors
  • Compliance-native delivery for regulated industries
  • End-to-end coverage from strategy through 24/7 managed services
  • 11,000+ enterprise engagements refined into repeatable, risk-controlled patterns

Call (888) 381-9725 or email contact@epcgroup.net for a free assessment.

Power BI Strategy: 2026 Considerations for Power BI Groupby

Row-level security (RLS) and object-level security (OLS) in Power BI Premium and Fabric F-SKU capacities are the single most-overlooked compliance control in HIPAA, SOC 2, and FINRA-regulated environments. RLS scoped via service principal authentication (rather than embedded UPN passes) is the only pattern that survives a SOC 2 Type II auditor privilege-walk test. EPC Group includes service-principal RLS as a default in every regulated-industry Power BI engagement.

Power BI Copilot grounds itself on the semantic model, NOT the underlying source data. That means Copilot answers are only as accurate as the DAX measure definitions, the field metadata (display folders, descriptions, hierarchies), and the synonyms taxonomy. In practice, the difference between a Copilot deployment that drives 32% time-savings and one users abandon within 90 days is whether the semantic model was Copilot-prepared.

Decision factors EPC Group evaluates

  • Direct Lake mode adoption for Fabric-resident semantic models
  • License optimization audit (Pro vs Premium Per User vs F-SKU)
  • Row-level security via service principal authentication
  • Capacity sizing decision (F2/F4/F64+) tied to peak concurrent users and refresh window
  • Copilot grounding quality assessment of semantic-model metadata

For a tailored read on this topic in your specific tenant, contact EPC Group at contact@epcgroup.net or +1 (888) 381-9725. Engagement options at /pricing.