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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Alex_ds
Frequent Visitor

count under text column in a table

Hello Everybody,

 

An easy question, how can I add count under a text column in a table? 

Captura.PNG

 Thanks so much¡

1 ACCEPTED SOLUTION

Hi @Alex_ds ,

 

Maybe we can create an index column to work around instead of using the Product.

Index = CALCULATE(DISTINCTCOUNT('Table'[Product]),FILTER('Table','Table'[Product] <= EARLIER('Table'[Product])))

 

Then we can update the measure as below and work it out.

Measure = 
VAR pro =
    MAX ( 'Table'[Product] )
RETURN
    IF ( ISFILTERED ( 'Table'[Index] ), pro, COUNT ( 'Table'[Product] ) )

2.PNG

 

Pbix as attached.

 

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

4 REPLIES 4
v-frfei-msft
Community Support
Community Support

Hi @Alex_ds ,

 

We can create a measure as below to work around.

Measure = 
VAR pro =
    MAX ( 'Table'[Product] )
RETURN
    IF ( ISFILTERED ( 'Table'[Product] ), pro, COUNT ( 'Table'[Product] ) )

Capture.PNG

 

For more details, please check the pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi v-frfei-msft,

It works correctly, thanks so much¡

Anyway, it just works if column "Product" is in the Table. Is there any chance it works if column "Product" is not in the table?

 

Grettings,

 

Alex

Hi @Alex_ds ,

 

Maybe we can create an index column to work around instead of using the Product.

Index = CALCULATE(DISTINCTCOUNT('Table'[Product]),FILTER('Table','Table'[Product] <= EARLIER('Table'[Product])))

 

Then we can update the measure as below and work it out.

Measure = 
VAR pro =
    MAX ( 'Table'[Product] )
RETURN
    IF ( ISFILTERED ( 'Table'[Index] ), pro, COUNT ( 'Table'[Product] ) )

2.PNG

 

Pbix as attached.

 

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
AilleryO
Memorable Member
Memorable Member

Hi,

 

My first thought is make a measure :

Number Of Producto = COUNTA([Producto])

But to display it only on the bottom line of your table is another question, may be just two tables with superposition ?

Hope it helps

 

Olivier

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.