Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi
I'm getting troubles to figure out how to get a column with number of visible lines with specific product.
(visible lines because at that moment slicers already filtered big list with dates, countries etc.)
I'd like to achieve in the matrix is something like this (yellow collumn is the one that I'm missing):
critical is to keep mutliple lines not cumulative view (which would be simplier)
I've tried:
Does anybody has an idea how to get that calculated additional column in the matrix (assuming that number needs to change depending on selection criteria/visible product lines)?
I think I've figured it out with a measure... I'm still checking if results are correct but looks fine. If you see any mistake in a logic please let me know.
repeat = CALCULATE(
COUNTROWS('table'),
FILTER(ALLSELECTED('table'),
IF(
COUNTX(FILTER('table', EARLIER('table'[product]) = 'table'[product]),'table'[product]
) > 0, true, false)
)
)
@Bart-ek seems like very complex measure for a simple count of rows. Why not sure sample data with the expected output, should be super simple.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi,
I've tried with count of rows but I've failed...
If you know how to do it simplier please let me know, because I also think it should be much simplier than I did.
Hi @Bart-ek ,
This should work.
Hi @Bart-ek ,
Not sure why this is not working in your .pbix file.
Tried to replicate it at my end and it seems to work fine.
your example:
Measure 5 = CALCULATE(COUNTROWS('Table 2'),ALLEXCEPT('Table 2','Table 2'[Sales Product]))
works in your example because you filter only by product, try to filter by the date and you'll see that number does not change even products are displayed less times.
I have a lot of filters by quantity, date etc. and I don't want to count all lines of product in the whole table, only already filtered lines needs to be counted.
Unfortunatelly it shows me incorrect results, for now only my solution works.
You may simply use the measure below.
Measure =
CALCULATE ( DISTINCTCOUNT ( 'Table'[date] ), ALLSELECTED ( 'Table'[date] ) )
Hi,
this shows 1 next to every line, you need to remember that I have individual values shown with every line, they're very often for the same product. I want to count how many lines are visible for the product, but because there's no more lines in the background of 1 visible line it will show 1. Such measures that will not use ALLSELECTED will always show me only 1. That would show correct number if I'd have cumulative table.