DAX UDF Parameter Modes: Stop Using VAL and EXPR Wrong

DAX UDF Parameter Modes: Stop Using VAL and EXPR Wrong

(00:00:00) The DAX UDF Dilemma
(00:00:32) The Context Transition Trap
(00:00:47) VAL vs XPR: The Core Decision
(00:01:39) The Best Customers Example
(00:02:52) When to Use VAL and XPR
(00:04:54) The Context Transition Problem
(00:05:57) Fixing the Context Transition Trap
(00:08:59) Materializing with Add Columns
(00:13:06) Parameter Types and Casting
(00:16:12) Authoring Checklist for UDFs

In this episode of M365.fm, Mirko Peters shows why most DAX user‑defined functions fail quietly — not because the math is wrong, but because parameter modes, context transition, and materialization are misunderstood.

WHAT YOU WILL LEARN
  • The real difference between VAL and EXPR: pass‑by‑value vs pass‑by‑expression and why it changes when your logic runs
  • Why using VAL for context‑sensitive metrics freezes results and produces “comfortably wrong” numbers
  • How EXPR behaves like a measure, and why you must wrap it with CALCULATE inside iterators to respect the current row
  • How to stop recomputing expensive expressions by materializing them once with ADDCOLUMNS and reusing the column
  • How data types, coercion, and BLANK handling can quietly change your results in UDFs
  • A practical “Mode → Move → Make” checklist you can apply to every new DAX function you write
THE CORE INSIGHT

DAX UDFs are not magic; they are just DAX with sharper edges. VAL vs EXPR decides whether you pass a frozen scalar or a living expression; context transition decides whether row context becomes filter context; materialization decides whether you pay the same expensive cost hundreds of times or once. If you ignore those three decisions, your UDFs will work in demos and betray you in production.

WHO THIS EPISODE IS FOR

This episode is ideal for Power BI developers, DAX authors, semantic model owners, and anyone building reusable calculation logic in enterprise models. If you’ve ever had a “correct” UDF that fails on slicers, ignores the current row, or suddenly becomes slow at scale, this conversation gives you the mental model and patterns to fix it.

ABOUT THE HOST

Mirko Peters is a Microsoft 365 and data platform consultant focused on building trustworthy, reusable semantic models on Power BI and Microsoft Fabric. Through M365.fm, Mirko shares practical DAX patterns, performance lessons, and modeling approaches that help teams move from fragile measures to robust, well‑behaved UDFs that stand up under real workloads.

Become a supporter of this podcast: https://www.spreaker.com/podcast/m365-fm-modern-work-security-and-productivity-with-microsoft-365--6704921/support.

Denne episoden er hentet fra en åpen RSS-feed og er ikke publisert av Podme. Den kan derfor inneholde annonser.

Episoder(847)

Agent Governance Explained- How IT Can Enable the AI Agent Revolution with Thomas Zou [Microsoft]

Agent Governance Explained- How IT Can Enable the AI Agent Revolution with Thomas Zou [Microsoft]

Every organization is talking about AI agents, but very few have a strategy for governing them. In this episode of M365.fm, host Mirko Peters sits down with Thomas Zou, Product Marketing Manager for M...

23 Jul 0s

Microsoft AppSource - Simply Explained

Microsoft AppSource - Simply Explained

Welcome to another episode of Knowledge Nuggets with Mirko Peters. Today we're exploring Microsoft AppSource, Microsoft's marketplace for business applications, consulting services, and industry solut...

23 Jul 0s

Agent Feed - Simply Explained

Agent Feed - Simply Explained

Welcome to another episode of Knowledge Nuggets with Mirko Peters. Today we're exploring Agent Feed, Microsoft's new supervision experience for AI agents inside Power Apps. As AI agents become capable...

23 Jul 0s

Microsoft Agent Framework - Simply Explained

Microsoft Agent Framework - Simply Explained

Welcome to another episode of Knowledge Nuggets with Mirko Peters. Today we're exploring the Microsoft Agent Framework, Microsoft's unified development framework for building enterprise-ready AI agent...

23 Jul 0s

Microsoft Fabric Real-Time Intelligence - Simply Explained

Microsoft Fabric Real-Time Intelligence - Simply Explained

Welcome to another episode of Knowledge Nuggets with Mirko Peters. Today we're exploring Microsoft Fabric Real-Time Intelligence, one of the most exciting workloads inside Microsoft Fabric that enable...

23 Jul 0s

Microsoft Fabric Data Warehouse - Simply Explained

Microsoft Fabric Data Warehouse - Simply Explained

Welcome to another episode of Knowledge Nuggets with Mirko Peters. Today we're exploring Microsoft Fabric Data Warehouse, Microsoft's modern cloud-native data warehouse built as part of the unified Mi...

23 Jul 0s

Microsoft Fabric Data Factory - Simply Explained

Microsoft Fabric Data Factory - Simply Explained

Moving data has always been one of the most complex parts of building a modern analytics platform. Organizations need to collect information from databases, cloud applications, APIs, files, and enterp...

23 Jul 0s

Microsoft Fabric - Simply Explained

Microsoft Fabric - Simply Explained

Data has become one of every organization's most valuable assets—but for many businesses, it's scattered across databases, cloud platforms, business applications, and analytics tools. Microsoft Fabric...

22 Jul 0s

Populært innen Politikk og nyheter

giver-og-gjengen-vg
aftenpodden
forklart
fotballpodden-2
aftenpodden-usa
stopp-verden
popradet
rss-gukild-johaug
hanna-de-heldige
det-store-bildet
dine-penger-pengeradet
rss-ness
nokon-ma-ga
lydartikler-fra-aftenposten
bt-dokumentar-2
aftenbla-bla
e24-podden
unitedno
rss-penger-polser-og-politikk
rss-utenrikskomiteen-med-bogen-og-grasvik