Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I have a model with just two tables: Table "Product" that contains the products names and table "Steps" that contains a row per production phase/step which are represented by a number. Not all products start in the same production step, some start in step 2 like product B. The tables are linked by the product column in a relation ship 1:*
I need to calculate which is the first production step for each product and show it in all the steps of the product in a table visual like this:
Desired result:
I select product B in a filter outside the table visual and in the table shoud display steps 1 and 2 of product B and the column with the measure "First Step" should displays always the number 2 which is the first step of product B.
To try achieve the above, I created the following DAX code:
First Step =
CALCULATE(
MIN(Steps[Step]),
REMOVEFILTERS(Steps[Step])
)and
First Step =
CALCULATE(
MIN(Steps[Step]),
ALLSELECTED()
)and in both cases I get the following result:
Why does the steps for other products appear in the table? Why is the table visual ignoring the filter on the Product when selecting the rows to display?
I thought the absence of autoexist behaviour occurs only when columns in the visual where from different tables, not when columns where from a single table (and a single column in the visual).
How can I get the desired result? (I just need those two columns in the table, no product in the table visual)
Thank you for the explanation.
Hello,
The behavior you are observing—where the table visual displays rows that should be filtered out—is due to how the First_Step measure interacts with the Filter Context.
Because your visual contains only the Steps[Steps] column and your current measure uses ALLSELECTED() or REMOVEFILTERS().You are explicitly instructing Power BI to ignore the specific row filter.
When a measure returns a non-blank value (in this case, the value "2") for every potential row in the Steps table, Power BI identifies those rows as relevant to the visual. This "forces" the display of rows (such as steps 1 and 4) that would otherwise be excluded, as they now possess an associated value within that context.
To achieve your desired result without adding the Product column to the visual, you can modify your measure to include a check for the current context. This ensures the calculation only returns a value if the step is natively relevant to the current filter selection.
Proposed DAX Measure:
Code snippet
First_Step =
IF(
NOT ISBLANK(SELECTEDVALUE(Steps[Steps])),
CALCULATE(
MIN(Steps[Steps]),
ALLSELECTED(Steps)
),
BLANK()
)
So this has nothing to do with auto exist behaviour?
I found in an article of @SQLBI by @AlbertoFerrari that SUMMARIZECOLUMNS internally converts this:
EVALUATE
SUMMARIZECOLUMNS (
TREATAS ( { "DAX", "Python" }, 'Projects'[Language] ),
TREATAS ( { 2018 }, 'Projects'[Year] ),
"Result", [# Projects All Time]
)in to this:
EVALUATE
SUMMARIZECOLUMNS (
CALCULATETABLE (
SUMMARIZE ( Projects, 'Projects'[Language], 'Projects'[Year] ),
TREATAS ( { "DAX", "Python" }, 'Projects'[Language] ),
TREATAS ( { 2018 }, 'Projects'[Year] )
),
"Result", [# Projects All Time]
)
so in my scenario, the Product column from the Products table is cross joined with Step column disabling auto exist and therefore evaluating the measure in all possible combination of Product and Step causing the behavior I'm seeing.
Is this correct? or I'm mixing up things?
Add a visual-level filter using this measure:
Is Current Product =
IF (
COUNTROWS ( Steps ) > 0,
1,
BLANK ()
)
you can try this
Proud to be a Super User!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 55 | |
| 34 | |
| 32 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 75 | |
| 72 | |
| 38 | |
| 35 | |
| 25 |