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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
vonschultz666
Helper I
Helper I

Dynamic filtering problem with DAX

Hi,

 

i have custom made DAX formula which dynamically generates a comma-separated list of StoreNo values from the raw unfiltered underlaying [SalesAnalysis] table based on the current dashboard selections of DivisionCode column and optionally StoreFormatCalculated column/slicer. I also use this logic as a KPI without CONCATENATEX, but with DISTINCTCOUNT.

 

Furthermore, i have matrix table chart with StoreNo columns, ItemNo rows and with SalesQuantity. My goal is to show matrix table only with those StoreNo values which are produced as a result of the mentioned formula. I want to show empty cells as well (StoreNo/ItemNo combinations with no data).

 

How to tackle that problem in the most efficient way? Calculated table? Visual-Level Filters? Something else?

 

This is the unfiltered view, i want to have P006 for the mentioned item to be shown empty when the Item is selected through a slicer. This isn't a case right now, therefore i need dynamic filtering

 

vonschultz666_1-1709772886635.png

 

 

 

 

List = 
VAR SelectedStoreFormat = SELECTEDVALUE('[SalesAnalysis]'[StoreFormatCalculated], "ALL")
VAR CurrentFilteredDivisionCodes = VALUES('[SalesAnalysis]'[DivisionCode])
RETURN
IF(
    SelectedStoreFormat = "ALL", 
    CALCULATE(
        CONCATENATEX(VALUES('[SalesAnalysis]'[StoreNo]), '[SalesAnalysis]'[StoreNo], ", "),
        FILTER(
            ALL('[SalesAnalysis]'), // Removes any existing filters from the 'SalesAnalysis' table
            '[SalesAnalysis]'[DivisionCode] IN CurrentFilteredDivisionCodes
        )
    ),
    CALCULATE(
        CONCATENATEX(VALUES('[SalesAnalysis]'[StoreNo]), '[SalesAnalysis]'[StoreNo], ", "),
        FILTER(
            ALL('[SalesAnalysis]'), // Removes any existing filters, starting from a 'raw' state
            '[SalesAnalysis]'[DivisionCode] IN CurrentFilteredDivisionCodes &&
            '[SalesAnalysis]'[StoreFormatCalculated] = SelectedStoreFormat
        )
    )
)

 

 

 

 

5 REPLIES 5
vonschultz666
Helper I
Helper I

Unfortunately this isn't working. Calculated tables in Power BI don't directly respond to slicer changes or filter contexts the way measures do because they are calculated once when the data is loaded or refreshed, not dynamically with slicer interactions.

Original formula which uses CONCATENATEX generates correct StoreNo list, and that list i want to use in my column of the matrix table chart.

Calculated Table i've createad with the following code always gives me the same StoreNo list:

 

StoreNoListTable = 
VAR SelectedStoreFormat = SELECTEDVALUE('SalesAnalysis'[StoreFormatCalculated], "ALL")
VAR CurrentFilteredDivisionCodes = VALUES('SalesAnalysis'[DivisionCode])
RETURN
CALCULATETABLE(
    SELECTCOLUMNS(
        VALUES('SalesAnalysis'[StoreNo]),
        "StoreNo", 'SalesAnalysis'[StoreNo]
    ),
    FILTER(
        ALL('SalesAnalysis'),
        'SalesAnalysis'[DivisionCode] IN CurrentFilteredDivisionCodes &&
        (SelectedStoreFormat = "ALL" || 'SalesAnalysis'[StoreFormatCalculated] = SelectedStoreFormat)
    )
)

 



Can somebody help me please?

some_bih
Community Champion
Community Champion

Hi @vonschultz666 try Calculated table





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Hi, will calculated table change according to the supposed dynamic (logic) of my formula?

If you apply your logic / measure and columns it should





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






And than i should use columns from the calculated table to filter StoreNo on the main table?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.