Forum Discussion
Filter for multiple values in one cell
- 3 years ago
KubenM
Sorry for the late response. I was trapped in a couple of meetings. I hope the following is what you're looking for.Count of BE Key = CALCULATE ( COUNTROWS ( VALUES ( 'Table'[BE Key] ) ), FILTER ( 'Table', VAR SelectedValues = VALUES ( FilterTable[Item Value] ) VAR String = 'Table'[Fixed Version] VAR Items = SUBSTITUTE ( String, " , ", "|" ) VAR Length = COALESCE ( PATHLENGTH ( Items ), 1 ) VAR T1 = GENERATESERIES ( 1, Length, 1 ) VAR T2 = SELECTCOLUMNS ( T1, "@Item", PATHITEM ( Items, [Value] ) ) RETURN COUNTROWS ( INTERSECT ( T2, SelectedValues ) ) ) )
Please try
Count of BE Key =
CALCULATE (
COUNTROWS ( VALUES ( 'Table'[BE Key] ) ),
FILTER (
'Table',
VAR SelectedValues =
VALUES ( FilterTable[Item Value] )
VAR String = 'Table'[Fixed Version]
VAR Items =
SUBSTITUTE ( String, " , ", "|" )
VAR Length =
COALESCE ( PATHLENGTH ( Items ), 1 )
VAR T1 =
GENERATESERIES ( 1, Length, 1 )
VAR T2 =
SELECTCOLUMNS ( T1, "@Item", PATHITEM ( Items, [Value] ) )
RETURN
NOT ISEMPTY ( INTERSECT ( T2, SelectedValues ) ) & 'Table'[Status] = "Done"
)
)
Hello tamerj1
Thank you for your feedback.
I applied the DAX and edited the dataset to only show one BE that rolled over for Y23PI1(To Do) to Y23PI2(In Progress) and then to Y23PI3(Done) and it isn't returning the correct count.
Please see below.
My question is, how would the DAX know that the BE(APO - 1) only reached the Done status in Y23PI3?
Table
DAX for Count of BE Done Status
Visual Based on the DAX applied
Based on the Table values, the Bar chart should only display the Count of 1 BE in the Done staus in Increment Y23PI3.
I must apologise for the complexity in my requirement.
- KubenM3 years ago
Advocate II
Dear tamerj1 You are really been my inspiration and support over the past 2 weeks. Thank you.
Thank you for the DAX.
Based on your previous DAX, this is what I used and it returns the same result. Only thing I didn't add was the +0 at the end of the DAX so that my card visual displays a 0 instead of the word blank 🙂Count of BE Without Epic =CALCULATE (COUNTROWS ( VALUES ( 'Table'[BE Key] ) ),FILTER ('Table',VAR SelectedValues =VALUES ( FilterTable[Item Value] )VAR String = 'Table'[Fixed Version]VAR Items =SUBSTITUTE ( String, ", ", "|" )VAR Length =COALESCE ( PATHLENGTH ( Items ), 1 )VAR T1 =GENERATESERIES ( 1, Length, 1 )VAR T2 =SELECTCOLUMNS ( T1, "@Item", PATHITEM ( Items, [Value] ) )RETURNNOT ISEMPTY ( INTERSECT ( T2, SelectedValues ) ) && 'Table'[BE Without Epic] = ""))Once again that you for all your assistance. Much appreciated.
This DAX thing is truly powerful. - KubenM3 years ago
Advocate II
Hello tamerj1 I replaced SUM( ('Table'[BE Key]) ),with SUM( ('Table'[BE Size]) ), and the visual responds with exactly what I needed. Thank you soo much for assisting me in this regard. Bless You.
Sum of BE Size =CALCULATE (SUM( ('Table'[BE Size]) ),FILTER ('Table',VAR SelectedValues =VALUES ( FilterTable[Item Value] )VAR String = 'Table'[Fixed Version]VAR Items =SUBSTITUTE ( String, ", ", "|" )VAR Length =COALESCE ( PATHLENGTH ( Items ), 1 )VAR T1 =GENERATESERIES ( 1, Length, 1 )VAR T2 =SELECTCOLUMNS ( T1, "@Item", PATHITEM ( Items, [Value] ) )RETURNNOT ISEMPTY ( INTERSECT ( T2, SelectedValues ) ) && 'Table'[BE Size])) + 0 - tamerj13 years ago
Community Champion
Count of BE With Epic =
COUNTROWS (
FILTER (
'Table',
VAR SelectedValues =
VALUES ( FilterTable[Item Value] )
VAR String = 'Table'[Fixed Version]
VAR Items =
SUBSTITUTE ( String, ", ", "|" )
VAR Length =
COALESCE ( PATHLENGTH ( Items ), 1 )
VAR T1 =
GENERATESERIES ( 1, Length, 1 )
VAR T2 =
SELECTCOLUMNS ( T1, "@Item", PATHITEM ( Items, [Value] ) )
RETURN
NOT ISEMPTY ( INTERSECT ( T2, SelectedValues ) )
&& 'Table'[BE Without Epic] = BLANK ()
)
) + 0 - tamerj13 years ago
Community Champion
KubenM
Have you tried?BE Size = CALCULATE ( SUM ( 'Table'[BE Key] ), FILTER ( 'Table', VAR SelectedValues = VALUES ( FilterTable[Item Value] ) VAR String = 'Table'[Fixed Version] VAR Items = SUBSTITUTE ( String, ", ", "|" ) VAR Length = COALESCE ( PATHLENGTH ( Items ), 1 ) VAR T1 = GENERATESERIES ( 1, Length, 1 ) VAR T2 = SELECTCOLUMNS ( T1, "@Item", PATHITEM ( Items, [Value] ) ) RETURN NOT ISEMPTY ( INTERSECT ( T2, SelectedValues ) ) && 'Table'[BE Size] ) ) + 0 - KubenM3 years ago
Advocate II
Hello tamerj1
Here’s my last query on the report I am building 😊
Based on the DAX filter you so generously built for me, how do I add the following DAX to it:
BE Without Epics = COUNTBLANK('Table'[BE Without Epic])+0
- In the data Table I added a column called “BE Without Epic” and in the column fields I entered 1 for where a BE has an Epic and left a Blank for the BE (APO – 4) that does not have an Epic.
- My card visual shows a 1 based on my simple COUNTBLANK DAX.
- When I filter on Y23PI1 or Y23PI2 or Y23PI3 or Y23PI4 the card must return 0.
- When I remove the filter selections or select F23PI5, the card must return 1.
- KubenM3 years ago
Advocate II
Hello tamerj1 Trust that you well. Not sure if I should create a brand new entry or keep my next question in this current response flow.
I am trying to edit the original DAX you created for me to include a new column called BE Size and the visual is only returning the count of BE and not showing the sum of the Story Points per BE size. See information I used below to inform my challenge.
Sum of BE Size
Table
FilterTable
DAX
Count of BE Size =
CALCULATE (
COUNTROWS ( VALUES ( 'Table'[BE Key] ) ),
FILTER (
'Table',
VAR SelectedValues =
VALUES ( FilterTable[Item Value] )
VAR String = 'Table'[Fixed Version]
VAR Items =
SUBSTITUTE ( String, ", ", "|" )
VAR Length =
COALESCE ( PATHLENGTH ( Items ), 1 )
VAR T1 =
GENERATESERIES ( 1, Length, 1 )
VAR T2 =
SELECTCOLUMNS ( T1, "@Item", PATHITEM ( Items, [Value] ) )
RETURN
NOT ISEMPTY ( INTERSECT ( T2, SelectedValues ) ) && 'Table'[BE Size]
))+0
Visual
How do I refine the DAX so that the Visual displays the Data Labels as Count of Size ie, 100 or 200 and the Total Labels to show size ie. 100 or 200, etc?
Note: The current visual isn’t reflecting the correct count.
Y23PI1 should show a stacked bar of 100 and 200 and the total label to show 300.
Y23PI2 should show a stacked bar of 200 and the total label to show 200
Y23PI3 should show a stacked bar of 200 and a total label of 200
Y23PI4 should show a stacked bar of 100 and a total label of 100
Y23PI5 should show a stacked bar of 250 and a total label of 250