How To Split Columns By Delimiters In Power BI Using DAX

Data preparation is a crucial step in any Power BI project, and one of the most common challenges is dealing with columns that contain multiple values separated by delimiters. Whether you’re working with comma-separated names, pipe-separated categories, or any other delimiter-based data, knowing how to split columns using DAX can save you significant time and effort.

Understanding Column Splitting in Power BI

When working with data in Power BI, you’ll often encounter columns that contain multiple pieces of information separated by specific characters (delimiters). Common examples include:

  • Full names separated by spaces: “John Smith”
  • Email addresses with domains: “[email protected]
  • Product categories separated by commas: “Electronics,Laptops,Gaming”
  • Geographic data with pipes: “USA|California|Los Angeles”

While Power Query provides excellent tools for splitting columns during data transformation, there are scenarios where you need to split columns dynamically using DAX calculations.

When to Use DAX vs Power Query for Column Splitting

Use Power Query When:

  • You need to split columns permanently during data load
  • The split logic is straightforward and won’t change
  • You want to minimize model size and improve performance

Use DAX When:

  • You need dynamic splitting based on user selections
  • The splitting logic needs to be conditional
  • You want to maintain the original column while creating split versions
  • You’re working with calculated columns or measures

Basic DAX Functions for Column Splitting

Key DAX Functions

Before diving into examples, let’s understand the essential DAX functions for string manipulation:

  • LEFT(): Extracts characters from the left side of a string
  • RIGHT(): Extracts characters from the right side of a string
  • MID(): Extracts characters from the middle of a string
  • FIND(): Locates the position of a substring within a string
  • SUBSTITUTE(): Replaces specific text within a string
  • LEN(): Returns the length of a string

Method 1: Splitting Two-Part Strings

Let’s start with the most common scenario – splitting a full name into first and last names.

Example: Splitting Full Names

// Extract First Name
First Name = 
LEFT(
    Table[Full Name], 
    FIND(" ", Table[Full Name]) - 1
)

// Extract Last Name  
Last Name = 
RIGHT(
    Table[Full Name], 
    LEN(Table[Full Name]) - FIND(" ", Table[Full Name])
)

Handling Cases with No Delimiter

To make your DAX more robust, handle cases where the delimiter might not exist:

// Safe First Name extraction
First Name = 
IF(
    ISERROR(FIND(" ", Table[Full Name])),
    Table[Full Name],
    LEFT(Table[Full Name], FIND(" ", Table[Full Name]) - 1)
)

// Safe Last Name extraction
Last Name = 
IF(
    ISERROR(FIND(" ", Table[Full Name])),
    "",
    RIGHT(Table[Full Name], LEN(Table[Full Name]) - FIND(" ", Table[Full Name]))
)

Method 2: Splitting Multi-Part Strings

For columns with multiple delimiters, you’ll need more sophisticated DAX formulas.

Example: Extracting Email Components

// Extract Username from Email
Username = 
LEFT(
    Table[Email], 
    FIND("@", Table[Email]) - 1
)

// Extract Domain from Email
Domain = 
RIGHT(
    Table[Email], 
    LEN(Table[Email]) - FIND("@", Table[Email])
)

// Extract Domain Name (without extension)
Domain Name = 
VAR DomainPart = RIGHT(Table[Email], LEN(Table[Email]) - FIND("@", Table[Email]))
VAR DotPosition = FIND(".", DomainPart)
RETURN
    IF(
        ISERROR(DotPosition),
        DomainPart,
        LEFT(DomainPart, DotPosition - 1)
    )

Method 3: Advanced Splitting with Multiple Delimiters

For complex scenarios with multiple different delimiters, you can use SUBSTITUTE to standardize delimiters first:

// Standardize delimiters and extract first part
First Part = 
VAR StandardizedString = SUBSTITUTE(SUBSTITUTE(Table[Mixed Delimiters], "|", ","), ";", ",")
VAR FirstCommaPosition = FIND(",", StandardizedString)
RETURN
    IF(
        ISERROR(FirstCommaPosition),
        StandardizedString,
        LEFT(StandardizedString, FirstCommaPosition - 1)
    )

Method 4: Creating a Generic Split Function

For repeated use, create a more generic approach:

// Generic function to get the Nth element from a delimited string
Nth Element = 
VAR DelimitedString = Table[Categories]
VAR Delimiter = ","
VAR Position = 2  // Get the 2nd element
VAR AddDelimiter = Delimiter & DelimitedString & Delimiter
VAR StringLength = LEN(AddDelimiter)
VAR FirstOccurrence = FIND(Delimiter, AddDelimiter)
VAR SecondOccurrence = FIND(Delimiter, AddDelimiter, FirstOccurrence + 1)
VAR Result = 
    IF(
        Position = 1,
        MID(AddDelimiter, FirstOccurrence + 1, SecondOccurrence - FirstOccurrence - 1),
        // Add logic for other positions as needed
        ""
    )
RETURN Result

Method 5: Dynamic Column Splitting with Measures

Sometimes you need to split columns dynamically based on user selections:

Dynamic Split Result = 
VAR SelectedSplitType = SELECTEDVALUE(SplitOptions[Split Type])
VAR SourceColumn = SELECTEDVALUE(Table[Source Column])
RETURN
    SWITCH(
        SelectedSplitType,
        "First Name", LEFT(SourceColumn, FIND(" ", SourceColumn) - 1),
        "Last Name", RIGHT(SourceColumn, LEN(SourceColumn) - FIND(" ", SourceColumn)),
        "Domain", RIGHT(SourceColumn, LEN(SourceColumn) - FIND("@", SourceColumn)),
        "No Selection"
    )

Best Practices for Column Splitting with DAX

1. Error Handling

Always include error handling to prevent your reports from breaking:

Safe Split = 
VAR SplitResult = 
    IF(
        ISERROR(FIND(",", Table[Data])),
        Table[Data],
        LEFT(Table[Data], FIND(",", Table[Data]) - 1)
    )
RETURN
    IF(ISBLANK(SplitResult), "", SplitResult)

2. Performance Considerations

  • Use calculated columns for static splits that won’t change
  • Consider using measures for dynamic splits that depend on user interaction
  • Pre-process complex splits in Power Query when possible

3. Data Quality Checks

Implement validation to ensure your splits are working correctly:

Split Validation = 
VAR OriginalLength = LEN(Table[Original Column])
VAR SplitLength = LEN(Table[Part 1]) + LEN(Table[Part 2]) + 1  // +1 for delimiter
RETURN
    IF(OriginalLength = SplitLength, "Valid", "Check Required")

Common Use Cases and Solutions

1. Geographic Data Splitting

Country = LEFT(Table1[Location], FIND("|", Table1[Location]) - 1)
State = MID(Table1[Location], FIND("|", Table1[Location]) + 1, FIND("|", Table1[Location], FIND("|", Table1[Location]) + 1) - FIND("|", Table1[Location]) - 1)

2. Product Code Parsing

Product Category = LEFT(Table1[Product Code], 3)
Product ID = RIGHT(Table1[Product Code], LEN(Table1[Product Code]) - 4)

3. Date and Time Separation

Date Part = LEFT(Table1[DateTime], FIND(" ", Table1[DateTime]) - 1)
Time Part = RIGHT(Table1[DateTime], LEN(Table1[DateTime]) - FIND(" ", Table1[DateTime]))

Troubleshooting Common Issues

Issue 1: “A function ‘FIND’ has been used in a True/False expression”

Solution: Wrap FIND functions in ISERROR() when using in IF statements.

Issue 2: Blank Results

Solution: Check for empty strings and handle them explicitly:

Result = 
IF(
    OR(ISBLANK(Table1[SourceCol]), Table1[SourceCol] = ""),
    "",
    // Your split logic here
)

Issue 3: Performance Problems

Solution: Consider moving complex splitting logic to Power Query or use variables to avoid repeated calculations.

Conclusion

You’ve now learned how to split columns by delimiters in Power BI using DAX! This a powerful technique that provides flexibility for dynamic data manipulation. While Power Query remains the preferred method for static transformations, DAX splitting becomes invaluable when you need conditional logic, user-driven splits, or when working with calculated columns and measures.

Remember to always include proper error handling, test your formulas with various data scenarios, and consider performance implications when choosing between DAX and Power Query approaches. With these techniques and best practices, you’ll be able to handle even the most complex column splitting requirements in your Power BI reports.

Start with simple two-part splits and gradually work your way up to more complex scenarios. The key is understanding how the basic string functions work together and building robust formulas that can handle edge cases in your data.

Keywords: How To Split Columns By Delimiters In Power BI Using DAX

Microsoft fabric free; Fabric free trial

Should I Upgrade to a free Microsoft Fabric Trial?

If you are exploring Microsoft Fabric and encounter the message “Upgrade to a free Microsoft Fabric Trial” despite already having workspace capacity, here’s what you need to know. This common confusion happens because certain Microsoft Fabric features, especially preview ones like SQL databases and AI Skills, require tenant-level preview feature enablement—even if your workspace is already on a Premium or Fabric capacity.

Why Does Microsoft Fabric Ask for a Free Trial?

When trying to create a SQL database or an AI skill (preview) inside Microsoft Fabric, some users see a prompt requiring them to “Upgrade to a free Microsoft Fabric Trial.” This happens because these preview features are disabled by default at the tenant level for the entire organization. Even if your workspace has an assigned capacity (Premium or Fabric), you need administrator privileges to explicitly enable these preview features.

How to Enable Microsoft Fabric Preview Features

If you are an admin, here’s what to do:

  1. Go to the Microsoft Fabric admin portal.

  2. Look for tenant settings related to preview features.

  3. Enable SQL Database (preview) and AI Skills (preview).

  4. Wait a few minutes (usually between 3 to 15 minutes) for the changes to take effect.

After enabling these settings, you can create a SQL database or AI skill in your workspace without the need to upgrade or start a new trial.

This step is essential because Microsoft Fabric treats these preview features separately from your existing capacity licensing. The message asking to upgrade to a free trial is somewhat misleading—it really means “You need tenant-level preview feature enablement.” This key insight was highlighted by Adam Saxton from Guy in a Cube in his video explanation.

Quick Links to Get Started with Microsoft Fabric Features

Summary and Best Practices

  • Microsoft Fabric preview features like SQL databases and AI Skills require explicit tenant enablement.

  • Even if you have Premium or Fabric capacity, these features are disabled by default for your organization.

  • Admins must enable preview features in the admin portal for users to access them.

  • The free Fabric trial message is a prompt triggered due to disabled preview features, not an actual lack of capacity.

  • After enabling the settings, wait a few minutes before the features become available.


By understanding this distinction, you can avoid confusion and start leveraging Microsoft Fabric’s powerful capabilities without unnecessary trial upgrades. For more tips and updates on Microsoft Fabric and Power BI, follow the community experts and stay tuned for new videos and tutorials.

keywords: Microsoft Fabric freeMicrosoft Fabric trialMicrosoft Fabric preview features, and Microsoft Fabric SQL database.

Feel free to share your questions or experiences with Microsoft Fabric preview features in the comments!

If you’re ready to dive deep into Microsoft Fabric and its rich capabilities, start creating your first SQL database or AI skill today using the official docs linked above. Unlock the full potential of your data analytics journey!

 

 

 

 

How To Calculate Averages Per Day In Power BI

How To Calculate Averages Per Day In Power BI Using DAX: A Practical Guide for 2025

When analyzing sales or any time-sensitive data in Power BI, understanding average performance per day can provide far more actionable insights than just looking at total sales or aggregated sums. Whether you’re measuring sales transactions, website traffic, or social media interactions, calculating the average sales per day in Power BI dynamically fuels smarter business decisions.

In this guide, you will learn a simple but powerful DAX formula technique to calculate averages per day that dynamically adjust across different customers, time periods, or product categories.

How To Calculate Averages Per Day In Power BI

Why Calculate Average Sales Per Day?

Absolute sales totals simply show overall volume but can be misleading if sales happened unevenly across the days. For example, a customer might have a big sale one day and no sales other days, making the average daily sales a better reflection of ongoing engagement or revenue generation.

Calculating the average per day helps to:

  • Track performance trends over time
  • Compare sales consistency across customers or regions
  • Analyze monthly or yearly performance with per-day precision
  • Optimize forecasting and target-setting processes

Understanding the Data Model

Before diving into DAX, you should have a data model in Power BI with tables such as:

  • Sales transactions (with sales amount, date, customer, product, region/area)
  • Date table (a fully connected calendar table for proper time intelligence)

This foundational setup allows you to slice and dice data dynamically by customers, months, years, or any relevant dimension.

The Core DAX Formula Explained

At the heart of this method is the usage of two essential DAX functions:

  • AVERAGEX() — iterates over a table and averages an expression evaluated for each row
  • VALUES() — generates a distinct list of dates within the current filter context

Here’s the conceptual approach:

  1. For each customer (or chosen dimension),
  2. Iterate through every distinct date in the current context,
  3. Calculate total sales for that date,
  4. Average all daily totals to get the average sales per day for that customer.

Sample DAX Formula for Average Sales Per Day

textAverage Sales Per Day = 
AVERAGEX(
    VALUES('Date'[Date]),
    CALCULATE(SUM('Sales'[TotalRevenue]))
)
  • VALUES('Date'[Date]) creates a virtual table of all dates currently in context (say for a filtered month or customer).
  • CALCULATE(SUM('Sales'[TotalRevenue])) calculates total sales for each date during iteration.
  • AVERAGEX averages those daily totals to produce the average sales per day.

How to Use the Formula Dynamically

When you add this measure to a Power BI visual, you can slice it by:

  • Customers to see average daily sales per customer
  • Months or years to analyze trends in different periods
  • Regions or product categories to evaluate average sales patterns across segments

Because the formula responds to your report filters, it automatically adapts to whatever dates or dimensions you select, making it a flexible and powerful metric.

Benefits of This Approach

  • Simplicity: A short, easy-to-understand DAX expression avoids complex calculations.
  • Dynamic Insight: Changes in filters instantly update the average calculations.
  • Versatility: Works across various dimensions without rewriting the formula—just place on different visuals.
  • Accurate Context Handling: Uses the date table effectively to handle partial months or custom time frames without errors.

Final Thoughts

If you want to deliver precise and insightful reports in Power BI, learning how to calculate averages per day with DAX is fundamental. This technique not only sharpens your data storytelling but empowers stakeholders to make data-driven decisions with confidence.

Power BI’s ability to dynamically slice data combined with powerful DAX functions means you can unlock valuable daily average metrics without heavy coding or manual calculation errors.

Try this formula on your own sales data model and watch how it reveals new perspectives on customer behavior and business performance trends over time.

I hope this blog post has truly shown you how to calculate averages per day in Power BI, since calculating averages for time-based data is useful in so many applications!

Keywords to help others find this post:

Power BI average sales per day, Calculate averages per day Power BI, DAX average sales calculation,Power BI time-based average calculations, Average sales per customer Power BI


Do You Need Personalized Help/Custom Solutions?

If you get stuck or you would like to explore solutions and automation possibilities, please can reach out to me for help as I do offer consulting services as time allows.  I have over 20+ years’ of expert level experience delivering excellent, custom, strategic solutions in Excel, BI, Access, SharePoint and more. 

I have been called a guru and hero more times than I can count, as I am a great listener and truly have a knack for asking the right questions to understand unique business challenges. I am very passionate about crafting tools and processes that work for users of all levels and experience. 

Reach out today and let’s discuss how I can help you and your business!

I also offer one-on-one tutoring for customized learning and upskilling. Visit my consulting page and send a message if you are interested.

Other Resources

Also, consider checking out some great resources on Amazon Disclosure: this is an affiliate link, so I may earn a small commission if you decide to make a purchase, which will help cover the cost of hosting this website. 

Please bookmark and subscribe!  I am actively working on adding new, relevant content to help others out! Thanks so much!

Subscribe via Email and Stay Up to Date!

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Buy Me A Coffee/Support the Blog 🙂

If I helped you, please consider leaving a tip via PayPal to support the blog! Thanks!!

Thanks so much for supporting my blog and for helping others too!

Fix incorrect matrix totals in Power BI

Fix Incorrect Matrix Totals in Power BI: A Practical How To Guide

If you work with Power BI, you’ve likely encountered the frustrating issue of incorrect or broken totals and subtotals in matrix visuals—especially when using custom DAX measures. This is a common challenge for Power BI users and often arises when your calculated measures work correctly for individual data rows but fail at the total or subtotal levels. Let’s explore practical techniques to fix incorrect matrix totals in Power BI using advanced DAX patterns, focusing on context evaluation, virtual tables, and the power of SWITCH(TRUE()) logic.

Fix incorrect matrix totals in Power BI: Mastering DAX for Accurate Totals in Your Reports

Fix incorrect matrix totals in Power BI

Why Do Matrix Totals Break in Power BI?

Matrix and table visuals in Power BI aggregate underlying data for totals and subtotals based on the context visible to DAX at each level. Custom measures that depend on row-level context may deliver accurate results for detail rows, but when Power BI computes grand totals, it often loses necessary filters or context, leading to blanks, incorrect sums, or illogical values.

Key causes for broken matrix totals include:

  • DAX measures relying on filters that aren’t present in the total row context.

  • Calculations designed for granular data that don’t make sense when rolled up.

  • Power BI’s automatic aggregation applying logic that doesn’t match business requirements.

Diagnosing and Understanding Matrix Context

Before constructing a fix, it’s vital to analyze how context changes at each level in a matrix visual:

  • Base rows: Both row and column context are present.

  • Subtotals (row or column): Only one of the two contexts is available.

  • Grand totals: Neither row nor column context exists.

A proven method for determining this context is using DAX’s HASONEVALUE function to check for the presence of filters on each axis.

Using SWITCH(TRUE()) for Totals Logic

The core solution involves writing a DAX measure using the SWITCH(TRUE()) construct. This allows you to specify different calculation paths for each possible context combination:

  1. When both row and column context exist (base rows), return your primary measure.

  2. When only row or only column context exists (subtotals), iterate and sum over the filtered context using SUMX and a virtual table.

  3. When neither context exists (grand totals), sum over all possible combinations.

A typical DAX pattern for this uses variables for selected values and a virtual table constructed with CROSSJOIN and ADDCOLUMNS. Here’s what such an approach usually involves:

  • Detect context using HASONEVALUE for each dimension (e.g., month, period).

  • Use SWITCH(TRUE(), …) to order context conditions from most specific (both present) to most general (neither present).

  • For subtotal and grand total contexts, employ SUMX over a virtual table containing all combinations needing to be aggregated.

Best Practices

  • Always write SWITCH(TRUE()) conditions from the most specific to the most general. If you start with general first, your specific logic will never execute due to early exits in SWITCH evaluation.

  • Clearly carve out logic for each level: detail rows, row subtotal, column subtotal, and grand total.

  • Use Tabular Editor or DAX Studio to debug your logic and preview virtual tables to ensure your calculations are on track.

Practical Example Scenario

Suppose you have a Spread Revenue measure that multiplies a simple revenue total by a scaling factor based on lookups. The detail rows work, but all totals show blanks or incorrect values. Using the steps above, you would:

  • Create variables for the selected period and month.

  • Build a virtual matrix table CROSSJOINing all relevant dimensions.

  • Define the measure using SWITCH(TRUE()) and HASONEVALUE checks, aggregating appropriately at each context level.

Voilà—totals and subtotals will now reflect correct logic, tailored to your business needs.

Takeaways

Fixing Power BI matrix totals is fundamentally about understanding DAX row and filter context. By harnessing SWITCH(TRUE()), HASONEVALUE, and virtual tables with SUMX, you gain precision and control over how your visuals aggregate data at every level. Mastering these advanced DAX patterns will eliminate broken totals and elevate the professionalism of your Power BI reports.

Keywords: Power BI, matrix totals, DAX, fixing totals, SWITCH(TRUE()), HASONEVALUE, virtual tables, SUMX, debugging Power BI, Power BI matrix visual, Power BI subtotals, Power BI grand totals, custom DAX measures, Power BI best practices, Tabular Editor, data modeling.


Do You Need Personalized Help and Custom Solutions?

If you get stuck or you would like to explore solutions and automation possibilities, please can reach out to me for help as I do offer consulting services as time allows.  I have over 20+ years’ of expert level experience delivering excellent, custom, strategic solutions in Excel, BI, Access, SharePoint and more. 

I have been called a guru and hero more times than I can count, as I am a great listener and truly have a knack for asking the right questions to understand unique business challenges. I am very passionate about crafting tools and processes that work for users of all levels and experience. 

Reach out today and let’s discuss how I can help you and your business!

I also offer one-on-one tutoring for customized learning and upskilling. Visit my consulting page and send a message if you are interested.

Other Resources

Also, consider checking out some great resources on Amazon Disclosure: this is an affiliate link, so I may earn a small commission if you decide to make a purchase, which will help cover the cost of hosting this website. 

Please bookmark and subscribe!  I am actively working on adding new, relevant content to help others out! Thanks so much!

Subscribe via Email and Stay Up to Date!

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Buy Me A Coffee/Support the Blog 🙂

If I helped you, please consider leaving a tip via PayPal to support the blog! Thanks!!

Thanks so much for supporting my blog and for helping others too!

Power BI error bars for uncertainty visualization

How To Utilize Error Bars In Power BI To Visualize Uncertainty In Your Data

How to Use Power BI Error Bars for Uncertainty Visualization: Step-by-Step Guide

Power BI error bars for uncertainty visualization are a game-changing feature, enabling data analysts and business users to represent confidence intervals, forecast uncertainty, and data variability directly on their line charts. In this comprehensive tutorial, we’ll explore everything you need to know: from enabling the feature to advanced interactivity through parameters.

What Are Error Bars and Why Do They Matter in Power BI?

When you’re visualizing forecast data or any measurement with natural variability, showing point estimates alone can be misleading. Power BI error bars for uncertainty visualization allow you to display possible ranges for each data point, communicating confidence and transparency in your data storytelling. This is especially critical for:

  • Sales forecasts with seasonality

  • Scientific measurements with instrument error

  • Survey results or estimates

By making uncertainty explicit, you empower your viewers to interpret results more accurately and make informed decisions.

Enabling Power BI Error Bars for Uncertainty Visualization

Before using error bars, make sure your version of Power BI Desktop supports them (this step is only needed in older versions):

  • Go to File > Options > Preview features.

  • Enable “Error Bars.”

  • Restart Power BI Desktop.

Pro tip: Error bars settings may continue to evolve, so always update Power BI for the latest enhancements.

Building Your First Power BI Error Bars for Uncertainty Visualization

1. Set Up Your Base Visual

Start with a basic line chart displaying your key measurement (e.g., Monthly Sales).

  • Drag your date/time to the X-axis and your main value (e.g., Sales) to the Y-axis.

2. Define Upper and Lower Bound Measures

You need two measures for each point—Upper Bound and Lower Bound—that will define the error bars.

Example DAX for relative error bars:

text
Sales Upper Bound = SUM(Sales[Amount]) + 5000
Sales Lower Bound = SUM(Sales[Amount]) - 5000

Place these measures in the chart’s “Error Bars” section.

You can also use dynamic calculations:

text
Sales Upper Bound = SUM(Sales[Amount]) * (1 + [Uncertainty Parameter])
Sales Lower Bound = SUM(Sales[Amount]) * (1 - [Uncertainty Parameter])

3. Configure the Error Bars Visual

Open the Analyze pane:

  • Under “Error Bars,” toggle On.

  • Choose “Relative” (fixed increase/decrease) or “Absolute” (direct upper/lower value).

  • Customize style: error lines, bars, or shaded areas for visual clarity.

Advanced Technique: Interactive Power BI Error Bars for Uncertainty Visualization with Parameters

Take uncertainty modeling further by letting viewers control the amount of uncertainty shown, using Power BI’s What-If parameters.

Steps:

  1. Create a What-If Parameter:

    • On the Modeling ribbon, select “New Parameter.”

    • Set as decimal, with a reasonable range (e.g., 0.0 to 0.3 for 0–30%).

  2. Reference the Parameter in Your Bounds:
    Update your upper/lower bound measures to multiply the main value by (1±parameter value).

  3. Add Parameter as Slicer:
    Place the parameter on the report canvas. Now, users can adjust a slider and watch the uncertainty range change interactively.


Why is this powerful?
Viewers can explore best-case/worst-case outcomes, stress test forecasts, or tailor visuals to their own risk tolerance—making Power BI error bars for uncertainty visualization remarkably interactive.

Practical Tips and Troubleshooting

  • Relative vs. Absolute: Use relative error bars for a fixed increment (±X), absolute for data-driven bounds (e.g., statistical deviations).

  • Labeling: Consider adding text or tooltip explanations so viewers grasp what the error bars represent.

  • Complex models: For forecast models with statistical confidence intervals, you can calculate upper/lower bounds using DAX or integrate with external R/Python forecasts.

  • Data Model: Store parameter values and error range calculations in your data model for auditability and reusability.

Real-World Scenarios for Power BI Error Bars for Uncertainty Visualization

  • Sales Forecast Dashboards: Show forecast ranges during high volatility periods.

  • Scientific Data: Display measurement error for each point, letting stakeholders see the instrument precision.

  • Customer Surveys: Represent margin of error due to sample size.

Conclusion

Embracing Power BI error bars for uncertainty visualization not only makes your reporting more honest but also improves trust and understanding among your audience. By combining error bars with interactive parameters, you offer viewers a dynamic, transparent, and engaging analytic experience.

With these steps, you’ll unlock the full potential of Power BI error bars for uncertainty visualization, turning simple line charts into robust storytelling tools.

Would you like a downloadable sample file, sample DAX, or even deeper dives into the DAX logic? Let me know in the comments!

Chart Screenshot/Example

Power BI error bars for uncertainty visualization

Do You Need Personalized Help and Custom Solutions?

If you get stuck or you would like to explore solutions and automation possibilities, please can reach out to me for help as I do offer consulting services as time allows.  I have over 20+ years’ of expert level experience delivering excellent, custom, strategic solutions in Excel, BI, Access, SharePoint and more. 

I have been called a guru and hero more times than I can count, as I am a great listener and truly have a knack for asking the right questions to understand unique business challenges. I am very passionate about crafting tools and processes that work for users of all levels and experience. 

Reach out today and let’s discuss how I can help you and your business!

I also offer one-on-one tutoring for customized learning and upskilling. Visit my consulting page and send a message if you are interested.

Other Resources

Also, consider checking out some great resources on Amazon Disclosure: this is an affiliate link, so I may earn a small commission if you decide to make a purchase which will help cover the cost of hosting this website. 

Please bookmark and subscribe!  I am actively working on adding new, relevant content to help others out! Thanks so much!

Subscribe via Email and Stay Up to Date!

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

If I helped you, please consider leaving a tip via PayPal to support the blog! Thanks!!

Thanks so much for supporting my blog and for helping others too!

How To Copy DAX Measures (Multiple) From Different Reports In Power BI

One of the frequent pain points in Power BI development is the lack of a native, built-in method for copying multiple DAX measures between reports. As your analytics practice grows, the need to reuse calculations, KPIs, or business logic across multiple Power BI files becomes both common and essential. Fortunately, there’s an efficient workaround using Tabular Editor— a popular external tool that comes in both free and paid versions —that can dramatically speed up your workflow. This post will show you the step by step method to easily copy DAX measures from one report to another.

The Challenge: No Native Bulk Measure Copy in Power BI

Power BI Desktop does not currently provide a feature for multi-selecting and copying measures from one .pbix report to another. Attempting to manually recreate measures is time-consuming and increases the risk of error, especially in projects with complex calculations.

The Solution: Tabular Editor to Copy DAX Measures

Tabular Editor allows users to access and manipulate the semantic model of a Power BI file directly. Using this tool, you can copy one, several, or even all measures from a source report, then paste them directly into your destination report—saving hours of work and frustration.

Head over to either https://www.sqlbi.com/tools/tabular-editor/ or https://tabulareditor.com/downloads

Download the Tabular Editor program and install the version that best suits your needs.

Once you install the program, when you next open the Power BI app, you should see the External Tools menu available. If it is not visible, try rebooting. If it is still not visible, reach out to your trusted IT support for further assistance if needed.

Step-by-Step Guide to Bulk Copy Measures

1. Open Both Source and Target Reports:
Launch Power BI Desktop and open both your source (.pbix) and destination reports simultaneously.

2. Launch Tabular Editor:
With your source report active, open Tabular Editor from the ‘External Tools’ menu. Do the same for your target report in a separate Tabular Editor window.

3. Prepare a Target Measure Table:
Ensure your target report has a table to receive the imported measures. If it doesn’t, create a blank “measures” table.

4. Select and Copy Measures:
In the source Tabular Editor window, select all the desired measures (use Ctrl+Click or Shift+Click for bulk-selection). Ctrl + C to Copy or select Copy from the Edit menu.

5. Paste into Target Report:
Switch to the destination Tabular Editor window. Right-click the appropriate table and Ctrl+V or select Paste from the Edit menu. All copied measures will appear.

6. Save Changes:
Click “Save” in Tabular Editor, and your new measures will become available in the target Power BI report.

6. Ensure Fields/Tables Match:
Return to Power BI and review the measures. Ensure that all tables and fields exist, or modify the measures as needed if there are any differences.

Why This Method Works

Tabular Editor interacts directly with the tabular data model behind your .pbix file, unlike Power BI’s own interface, which restricts mass management of measures. This approach is not officially supported by Microsoft, but it is widely used and greatly increases productivity within the Power BI community.

Tips and Caveats

  • Quick Measures: Some complex or “Quick Measures” may require additional adjustment after copying, especially if you have differences in your table/column structure.

  • Annotations: For optimal compatibility, remove format annotations via the Advanced Scripting tab in Tabular Editor before copying, especially if you run into errors.

  • Free and Paid Versions: The described process works with both the free and paid versions of Tabular Editor.

Conclusion

Reusing DAX measures across reports no longer needs to be tedious. With Tabular Editor, you can bulk copy and paste measures within a few clicks, supercharging your Power BI workflow. For teams and consultants frequently working with standardized metrics, this is an indispensable part of your Power BI toolkit.

Tabular Editor Screenshot

Copy DAX Measures in Tabular Editor program

If you’d like more advanced automation tips or guides on optimizing your Power BI modeling practices, let us know in the comments!

Solution for Power BI Refresh Error in the Web Service

Web Service Power BI Refresh Error When Trying to Refresh On Premises 32-bit Database/Source

I recently worked with a client who is still using an old 32-bit Oracle instance with lots of dependencies. Upgrading is not currently an option. In her Power BI report/model, she is querying several tables in the Oracle database. Unfortunately due to the 32-bit architecture she was not able to schedule her refreshes, even using the desktop gateway.

The Power BI refresh error she received was “Failed to update data source credentials: An error happened while reading data from the provider: ‘Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.'”

Workaround for Power BI Refresh Error in Web Service When Trying to Refresh On Premises 32-bit
Power BI Architecture Error

As a result, she found she could only refresh this report using the Power BI desktop client. She would then manually publish to the cloud. This was cumbersome as the data refresh took quite some time, and she needed it done daily. I came up with two solutions for her, both of which we implemented and tried. One proved to better for us, and ultimately she is successfully using this first solution/workaround that I will cover.

Solution #1Export Query Results to CSV and Post on SharePoint

  • So just as the title of the section states, the final workaround was for us to automate the generation of CSV files to ultimately be consumed by Power Query.
  • We did this by using a combination of scripts pulling data via SQL in VBA (Access, Excel) and via SQL in Python. You can pull the data any way you are most comfortable (macros, etc.).
  • The query results are then outputted to the CSV files, which are written directly to SharePoint folders.
  • After all this was set up and the initial files were changed, we then changed the source of the data in Power Query, to now navigate to SharePoint folders and then process the CSV files.
  • It is important to note that you are not required to use CSV files. These made sense in our case due to the amount of data we were working with (generating several very large files nightly). You can write to any supported file format if that works better in your case, as long as you can place it on SharePoint and Power Query can process it.
  • Also as noted we used a separate folder for each unique query. If you are also replacing several queries, you can either do this (write to separate folders) or if you would prefer just one, then utilize different naming convention patterns to filter.
  • Everything is then kicked off via a command line batch script (.bat) using the Windows task scheduler on her desktop to run overnight. We also set up the same script on a colleague’s PC as a backup/for redundancy in case something were to happen, but it is not actively running.
  • After refreshing and publishing the updated report with the new SharePoint sources, I then went into settings in the Web Service and added the credentials there for SharePoint. I saved and kicked off the refresh in the browser.
  • The refresh was successful, so I then set a daily schedule for the web service to refresh automatically. No intervention has been needed since implementation!

Solution #2 – Automate the Power BI Desktop Refresh Process Using Python

  • This method is much less convenient in my opinion, as after it had been implemented, it failed often and required manual intervention several times before we moved on to the other solution.
  • Another caveat is that this solution requires the user to have at least some familiarity with Python (or finding someone with Python knowledge to tap as a support resource).
  • Also, obviously someone needs to install Python, the required package and then set up the automation to run the scripts.
  • Important note – it is possible to install a portable version of Python if you do not have admin rights on the desktop.
  • The package is called pbixrefresher (repo is linked).
  • This gentleman does a great job of walking through setting it up in his YouTube video about it: https://youtu.be/wtXXpicCUlY

I hope this post has been helpful and has maybe given you some ideas on how to proceed if you or an organization you are supporting is facing this same situation with older data sources. Also, I’d love to hear about other solutions if you’ve faced the same issue and handled it differently.

Please reach out with any questions or if you would like to see further coverage of any of the concepts/steps mentioned in this post. I am also available on a limited basis for consulting as my schedule is full as of late (a good thing!). Just fill out the contact form and I will get back to you.

How To Create 3D Scatter Plots In Power BI Using Python

3D scatter plots are mainly used to plot data points in three axes with the objective of showing the relationship between three variables. In this video, Gaelim is going to demonstrate how you can make a 3D scatter plot on Power BI using Python code.

***** Video Details *****
00:00 Introduction
00:44 Data set
01:03 Importing packages
02:06 Loading seaborn data set
02:45 Dimensions & metrics
03:05 Setting x, y, z variables
03:38 Creating a figure
05:44 Creating plots
08:00 Setting axes names
09:09 Interactivity
10:10 Altering viewpoint
11:10 Bringing into Power BI

***** Learning Power BI? *****
FREE COURSE – Ultimate Beginners Guide To Power BI – http://portal.enterprisedna.co/p/ultimate-beginners-guide-to-power-bi
FREE COURSE Continue reading “How To Create 3D Scatter Plots In Power BI Using Python”

Organize your DAX measures

How To Organize Your DAX Measures in Power BI Folders and Make Finding Them A Breeze

As you progress in Power BI, you will gradually be working with more DAX measures and calculations. As a result, things can easily get cluttered. Today you will learn a few valuable tips and tricks on how to organize your DAX measures for a more efficient workflow. Hopefully this will help you and become a standard practice!

Watch the video for step by step instructions and a full explanation.

To summarize, Reid shows us how to add a new table and move our measures to it so they are together in one place.

He then shows us how to convert this into a folder, and then subsequently create subfolders to further organize your DAX measures in the model. Reid continues on to show us how we can have a measure in multiple locations if it makes sense.

What a great way to manage the measures as they grow in number!

***** Video Details *****
00:00 Introduction
00:33 Root folders
01:32 Subfolders
03:30 Actual Amount VTB

***** Learning Power BI? *****
FREE COURSE – Ultimate Beginners Guide To Power BI – http://portal.enterprisedna.co/p/ultimate-beginners-guide-to-power-bi
FREE COURSE – Ultimate Beginners Guide To DAX – http://portal.enterprisedna.co/p/ultimate-beginners-guide-to-dax
FREE – Power BI Resources – http://enterprisedna.co/power-bi-resources
FREE – 60 Page DAX Reference Guide Download – https://enterprisedna.co/dax-formula-reference-guide-download/
Enterprise DNA Membership – https://enterprisedna.co/membership
Enterprise DNA Online – http://portal.enterprisedna.co/
Enterprise DNA Events – https://enterprisedna.co/enterprise-dna-events-page/

#EnterpriseDNA #PowerBI #PowerBIDesktop #PowerBITutorial #DAX #DAXTutorial

rank in Access

Solved: Pass a Parameter to a SQL Query in Power Query

I’ve done a fair amount of research around dynamic and parameterized queries, specifically around an Excel query parameter, as in trying to pass a parameter to a SQL query in Power Query.  Here’s the very quick and easy way to do this!

This exact solution works in Excel. Creating a dynamic SQL query with a parameter in Excel allows for amazing flexibility. The use cases are endless and can benefit so many types of Excel work across industries – if you are querying any data source, such as a database, even an Access database, then parameterized querying in Excel can truly simplify your workflow. I am going to cover SQL queries specifically, but please comment below if you would like a tutorial on using a parameter with other data sources. Nearly anything is possible!

You can also easily use parameters in Power BI, but the process for creating the parameter itself is slightly different – I will cover that in a future post.  The query construction is the same in most cases though. Please note that this post assumes you are at least moderately familiar with SQL querying and Power Query. Your mileage may vary depending on your situation.

If you found this post because you are encountering a firewall error when incorporating a parameter, skip right on to that section below (click here) for the solution. After much trial and error, I have found a way that works to overcome this issue harnessing the power of query folding. 

The Solution: Passing a Parameter to a SQL Query

In my example, “SParameter” is the name of the parameter I am using, and it represents a store number (retail location identifier). The related field in my SQL table is [Store].

Create the parameter:

  • In any worksheet, add a new table, with a single record and column.  I highly recommend the Header clearly clarifies what the parameter is so there is no confusion in identifying it.
  • Add this table into Power Query by selecting the table, then Data > From Table/Range
  • When the query editor opens, if necessary, change the data type (in my case I need it to be text).  This is important!
  • Right click on the record and select “Drill Down”.  Since you have only a single record, this step will automatically create a parameter.  
  • In the properties, I name this SParameter (you may enter the name of your choice for your parameter).  Note that the name is case sensitive.

This is how the table is situated in my worksheet (1 is the parameter/the value I will change as needed):

This is how it looks in Power Query after all steps above were completed (I named the column from Enter Store: to Store to make it cleaner (this is an optional step):

Open or Add your SQL Server Query in Power Query

Add your query into the Advanced Editor.


let
Source = Sql.Database(“your connection name”, “your database name”, [Query=”

your query goes here

“])


Create the SQL query with your parameter:

Here’s my simple query example to demonstrate how to build the query with the parameter. Please substitute your table name and fields, as well as your parameter name.

With the parameter in the WHERE clause

“Select  * FROM StoreDetail.Store WHERE Store =” &SParameter&”

  • Simply build your unique SQL statement in Power Query following my example above, adding your parameter into the query with quotes and the & (ampersand) sign surrounding the parameter name.
  • Check the results and modify as needed.
  • If your query has no additional clauses or criteria, simply put quotes and one & sign ahead of the parameter, and then one after followed by two double quotes to close the query statement.

 Additional criteria in the WHERE clause

Here is an example where I have additional criteria in mine, filtering on the OpenDate field; after the second quote, add a space and then continue on with the rest of your query.

Select  * FROM Storelist WHERE Store =” & SParameter &” AND OpenDate < GetDate()-365

This is an example of the properly formatted parameter looks in the Advanced Editor in Power Query (I have built out my query further with the Group By clause – this is optional if it doesn’t apply in your case).

If you are running into issues with the query, you may need to add in single quotes surrounding the parameter (inside of the double quotes – “WHERE Store =‘” & SParameter & “‘;”), or possibly # signs surrounding your parameter inside of the double quotes, if your parameter is a date.  You may have to test with and without these depending on your unique scenario.  

If the query is successful, you can proceed with saving it or adding in additional steps in Power Query if you are further filtering or transforming the resulting data you pulled.

BONUS Information – if you are wondering what GetDate() is, this is the MS SQL current system date, so in a way this is technically a dynamic parameter as well.  In my case, the query will only return stores with an open date that is older than 365 days based on today’s date.  You may find this useful for your query as well if you are looking for dynamic dating.

After updating your parameter in the worksheet table, Select Refresh All from the Data menu and your updated query will run and return the results accordingly!

Managing Privacy Levels in Power Query/Excel

VERY IMPORTANT: If you are sharing your workbook with others, you may need to edit the Privacy Levels in order for the queries with parameters to work for them. Read on for these important steps.

In Excel Power Query, there are security measures in place to help prevent data from being shared unintentionally. When combining query sources by using the parameter (a value in your Excel file with a SQL server source), many times this security comes into play.

If other users are having an issue refreshing the query/queries where you have added a parameter into the SQL query, please have them follow these steps. I actually copy and paste this right into an Instructions tab of each of the shared workbooks containing parameters that I create for my clients and for colleagues.

  • Go to Data, click Queries & Connections.
  • Your query list will show up in the panel on the right.
  • Right click any query in the list and choose Edit.
  • A window will open. Click File, then Options and settings.
  • Choose Query Options.
  • Click Privacy, which is on the menu on the left, at the bottom.
  • Select the radio button for the Ignore the Privacy Levels and potentially improve performance option.
  • Click OK to save.
  • Click Close & Load in the Power Query Editor window (at the top) to exit the settings.
Parameter to a SQL query (privacy settings)

Troubleshooting/Alternate Method – Firewall issue

If you run into this dreaded error: “Formula.Firewall: Query ‘SParameter (2)’ (step ‘Filtered Rows’) references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.”, then you will need to use this alternate method.

If you received the firewall error above, you can still use your parameter, but you will instead need to use the parameter as a filter in a subsequent step.  Now you may be possibly thinking – my table has thousands (or even millions) of records and I don’t want them all pulling in – don’t worry, this is the beauty of the query folding process when it works properly in Power Query.

Without the parameter in the WHERE clause

Select * FROM StoreDetail.Store WHERE OpenDate < GetDate()-365

  • Write your SQL statement in Power Query as noted above.
  • When the Query Editor returns the columns and record sampling, for the field you will be using your parameter, filter with any single value (Text Filters > Equals). This is simply a placeholder, to create the Power Query M formula for the next step.
  • You will now see that filtering in the formula bar. 
  • Replace the placeholder value with the name of your parameter, removing any quotes from the placeholder.  This is how it looks for me: = Table.SelectRows(Source, each [Store] = SParameter).
  • Power Query is smart enough to modify its native query to use the parameter, so it’s not going to pull in the millions of records and then filter after the fact.  Success!!  This is the power of Query Folding!

Why Can’t You Include the Parameter in the SQL Statement?

In the SQL statement, in most cases we will want add the store number/SParameter as part of the criteria in the select statement.  It may seem counter intuitive, but we cannot always successfully put the parameter directly into the SQL code/query. The challenge is that you are combining data sources and at this time, this is not allowed due to the built in security (SParameter portion is local, SQL portion is external).  Unfortunately some organizations have policies that disallow this. Sometimes it is an Excel version issue.

I truly hope this post helped you out.  If so, please feel free to leave a comment below letting me know so, and if you’d like, add what you’d like me to cover in a future post. Also, feel free to share this with someone else who may find it useful.

Do You Need Personalized Help and Custom Solutions?

If you get stuck or you would like to explore solutions and automation possibilities, please can reach out to me for help as I do offer consulting services as time allows.  I have over 20+ years’ of expert level experience delivering excellent, custom, strategic solutions in Excel, BI, Access, SharePoint and more. 

I have been called a guru and hero more times than I can count, as I am a great listener and truly have a knack for asking the right questions to understand unique business challenges. I am very passionate about crafting tools and processes that work for users of all levels and experience. 

Reach out today and let’s discuss how I can help you and your business!

I also offer one-on-one tutoring for customized learning and upskilling. Visit my consulting page and send a message if you are interested.

Other Excel Resources

Also, consider checking out some great Excel resources on Amazon Disclosure: this is an affiliate link, so I may earn a small commission if you decide to make a purchase, which will help cover the cost of hosting this website. 

Please bookmark and subscribe!  I am actively working on adding new, relevant content to help others out! Thanks so much!

Subscribe via Email and Stay Up to Date!

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Buy Me A Coffee/Support the Blog 🙂

If I helped you, please consider leaving a tip via PayPal to support the blog! Thanks!!

Thanks so much for supporting my blog and for helping others too!

Create A Gantt Chart In Power BI With A Matrix Visual

Managing projects effectively requires clear visuals that communicate timelines and task progress at a glance. While Power BI offers many visuals, building a Gantt chart using the built-in Matrix visual is a powerful technique for showing detailed project timelines without needing custom visuals. This blog post walks through the key concepts and steps for creating a Power BI matrix Gantt chart, perfect for project managers and data analysts alike.

What is a Matrix Gantt Chart in Power BI?

A Gantt chart visually represents project schedules by showing tasks as bars mapped over calendar dates. Unlike using custom Gantt chart visuals, you can cleverly use Power BI’s matrix visual combined with DAX formulas and conditional formatting to mimic a Gantt chart. This approach is advantageous because it leverages native visuals without extra installation, is highly customizable, and integrates seamlessly with your existing data models and filters.

Why Use a Matrix Gantt Chart?

  • Native Power BI Visual: No need for third-party downloads or licensing.
  • Dynamic and Interactive: Integrates with slicers and filters for dynamic timeline updates.
  • Detailed Task View: Offers drill-down capabilities across project hierarchies.
  • Full Control Over Design: Customize colors and styles through conditional formatting rules.

Step-by-Step Guide to Creating a Power BI Matrix Gantt Chart

  1. Prepare Your Data Model
  2. Your dataset should include at least these columns:
    • Project or Task Name
    • Start Date
    • End Date or Duration(Optional)
    • Task Status or Category
    • You also need a Date table in your data model to serve as a timeline backbone.
  3. Establish Relationship sConnect your Date table to your Project table using the Start Date (and possibly End Date) fields to enable time intelligence across visuals.
  4. Create a Matrix Visual
    • Place Project Name (and subcategories if needed) in the Rows.
    • Place Date from the Date table in the Columns.
  5. Create a DAX Measure to Highlight Task DurationWrite a measure that returns 1 if a given date falls within the task start and end dates and 0 otherwise. This will be the basis for your Gantt bars.Example simplified logic: TaskActive = IF( SELECTEDVALUE('Date'[Date]) >= MIN('Projects'[StartDate]) && SELECTEDVALUE('Date'[Date]) <= MAX('Projects'[EndDate]), 1, 0 )
  6. Apply Conditional Formatting Use conditional formatting on the Matrix’s Values field. Format the background color to:
    • Show a distinct color (e.g., gold or blue) when the TaskActive measure equals 1. Show a lighter or neutral color when 0.
    This creates the visual bars of the Gantt chart within the matrix cells.
  7. Enhance Your Visual
    • Turn off subtotals for clarity.
    • Use slicers to filter projects or timelines dynamically.
    • Add tooltips with task details.
    • Customize colors by task status or category using additional measures and formatting rules.

Benefits of Using a Matrix Gantt Chart in Power BI

  • Cost-effective: No licensing or external visuals needed.
  • Integrated experience: Aligns with your Power BI reports and dashboards perfectly.
  • Scalable: Works well from small projects to complex multi-phase portfolios.
  • Customizable: You control colors, interactivity, and granularity.

By leveraging Power BI’s matrix visual combined with smart DAX measures and conditional formatting, you can build a robust, customizable Gantt chart tailored to your project management reporting needs. Start experimenting with your project data today and unlock richer timeline insights right inside Power BI!

Other Options/Resources

For those interested in alternative approaches, there are also custom Gantt chart visuals available in Power BI Marketplace, but the matrix method provides unmatched flexibility and control for many project reporting scenarios.

Cross Selling Matrix Deep Dive – Power BI & DAX Tutorial (Market Basket)

Understanding the Cross Selling Matrix in Power BI

A cross selling matrix is a powerful visualization used in sales analytics to identify which products are often purchased together by the same customers over a selected period. This form of basket analysis helps businesses uncover cross-selling opportunities, promotional ideas, boost revenue, and optimize product strategy.

The video demonstrates not just the process of creating a cross selling matrix in Power BI, but dives deep into the crucial concepts of DAX, context transition, and relationship management needed to generate accurate, actionable insights.

Key Steps and Concepts

1. Foundational Understanding: Context in Power BI & DAX

  • Context determines how your formulas and visuals behave. The row and column headers of your matrix create unique contexts for every cell, impacting which data is aggregated or filtered.
  • Proper understanding of context ensures your DAX calculations are returning meaningful results for each product pairing in the matrix.

2. Core Calculation: Customers Who Purchased Both Products

  • The goal is to find out, for any intersection in the matrix, how many customers bought Product A (row) AND Product B (column) within the selected date range.
  • This is done by creating two tables:
  • Table 1: All customers who bought Product A.
  • Table 2: All customers who bought Product B.
  • The INTERSECT function is then used to find customers common to both tables.
  • The final result is a COUNTROWS(INTERSECT(…)), revealing the number of unique customers who purchased both products.

3. DAX Techniques Used

  • VALUES(): Used to dynamically return a list of customers filtered by the current context (product, time frame, etc.).
  • CALCULATETABLE(): Allows creation of virtual tables filtered by specific product or comparison product context.
  • TREATAS(): Establishes virtual relationships between tables where no direct relationship exists, vital for comparing separate product lists.
  • ALL() or ALLEXCEPT(): Used to remove or adjust existing model relationships temporarily, isolating the proper comparison across products for accurate results.

4. Supporting Table for Comparison

  • To evaluate pairwise cross-selling (row vs column), a comparison products table is created, usually replicating your products dimension but used solely for comparison logic.
  • This table is not physically related to the sales table, so relationships are built on-the-fly in DAX using TREATAS.

5. Dynamic Filtering and Analysis

  • The entire technique is dynamic, meaning selecting different dates or filters in your Power BI report instantly recalculates the matrix.
  • This adaptability makes the matrix valuable for both exploratory analytics and operational dashboards.

Why Build a Cross Selling Matrix?

  • Reveal Product Affinities: Quickly see which items are often bought together, ideal for bundle promotions and recommendations.
  • Drive Sales Strategies: Identify which products could benefit from cross-promotion or upselling.
  • Customer Insight: Understand multi-product purchasing behavior within your customer base.

Example DAX Pattern for Purchased Both Products

Purchased Both Products = 
VAR Customers_ProductA =
    VALUES(Sales[CustomerID]) // For current row product context
VAR Customers_ProductB =
    CALCULATETABLE(
        VALUES(Sales[CustomerID]),
        TREATAS(VALUES('Comparison Products'[ProductID]), Sales[ProductID])
    )
RETURN
    COUNTROWS(INTERSECT(Customers_ProductA, Customers_ProductB))
  • Replace column/table names as per your own model.
  • Adjust context and relationships as necessary for your specific data schema.

Takeaway

By mastering this advanced cross selling matrix technique and the supporting DAX concepts (like context, table functions, and virtual relationships), you empower yourself to unlock powerful, nuanced insights into customer behavior and product performance using Power BI.

If you’re keen to further enhance your skills on this, Enterprise DNA is a superb resource! Check them out and watch their video on this below! 🙂


[1] https://www.youtube.com/watch?v=iZJz30LSik4