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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Sebastián_Limon
Regular Visitor

Count transactions by category

Hi, I need help with a measurement. I need to count how many transactions certain amounts of product categories contain.

The categories can be three Calzado, Ropa and Accesorios.

For example, I want to know how many transactions contain Ropa and Accesorios.

Here, I leave an example table. where seven transactions contains "Ropa and Accesorios"

folionum	grupo
7550286	Ropa
7550286	Ropa
7550287	Ropa
7550287	Ropa
7550288	Ropa
7550288	Ropa
7550288	Calzado
7550289	Ropa
7550290	Ropa
7550290	Accesorios
7550290	Accesorios
7550291	Accesorios
7550292	Ropa
7550292	Ropa
7550292	Accesorios
7550293	Ropa
7550293	Accesorios
7550294	Ropa
7550294	Calzado
7550295	Ropa
7550295	Accesorios
7550296	Accesorios
7550297	Ropa
7550297	Ropa
7550297	Accesorios
7550298	Ropa
7550298	Accesorios
7550299	Accesorios
7550299	Ropa
7550299	Ropa
7550299	Ropa
7550300	Ropa
7550300	Accesorios


I am using the following measure, but it doesn't work

Transacciones de Productos = 
        CALCULATE(
        COUNTAX(
            FILTER(
                VALUES('Base Limonada 23'[folionum]);
                CALCULATE(
                    DISTINCTCOUNT('Base Limonada 23'[grupo]);
                    'Base Limonada 23'[grupo] IN {"Ropa"; "Accesorios"}
                ) = 2
            );
            1
        )
    )



 

1 ACCEPTED SOLUTION
WinterMist
Impactful Individual
Impactful Individual

@Sebastián_Limon 

 

OK, for some reason that I don't fully understand, I had to create a 3rd measure to make the total work correctly.

(I believe it has to do with context transition.)

 

Anyway, here are the 3 measures:

 

WinterMist_0-1689110781522.png

 

WinterMist_1-1689110840382.png

 

WinterMist_2-1689110888236.png

 

Results:

 

WinterMist_3-1689110969221.png

 

Hopefully this is helpful to you.

 

Regards,

Nathan

 

View solution in original post

5 REPLIES 5
ThxAlot
Super User
Super User

grupo.pbix

 

A generic solution

 

ThxAlot_0-1689119541161.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



WinterMist
Impactful Individual
Impactful Individual

@Sebastián_Limon 

 

OK, for some reason that I don't fully understand, I had to create a 3rd measure to make the total work correctly.

(I believe it has to do with context transition.)

 

Anyway, here are the 3 measures:

 

WinterMist_0-1689110781522.png

 

WinterMist_1-1689110840382.png

 

WinterMist_2-1689110888236.png

 

Results:

 

WinterMist_3-1689110969221.png

 

Hopefully this is helpful to you.

 

Regards,

Nathan

 

Thanks Nathan! it worked perfect.

@Sebastián_Limon 

 

Glad to help.  You are welcome.

WinterMist
Impactful Individual
Impactful Individual

@Sebastián_Limon 

 

I'm about 90% there.  Should have the last bit worked out shortly.

 

WinterMist_0-1689105571206.png

 

WinterMist_1-1689105603218.png

 

WinterMist_2-1689105683110.png

 

 

As you can see from the screenshots, the 2 measures are working properly within the rows of the table visual.

However, the total of 15 is not correct.  The correct total should be 8.

I believe this has to do with additive vs. non-additive measures.

 

I'll get back to you soon.

 

Regards,

Nathan

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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