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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Count repeated

Good afternoon,
I have a table with DATE, MONTH, NO CONTAINER (alphanumeric). I need to calculate the total containers per month. According to the text, January has 10 records and I need the answer to be 3 containers (1-18, 2-18, 3-18)

 

MONTH         NO CONTAINER

Enero             1-18

Enero             1-18

Enero             1-18

Enero             2-18

Enero             2-18

Enero             3-18

Enero             3-18

Enero             3-18

Enero             3-18

Enero             3-18

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

When you make a measure the calculations for total are make based on context so when you are in the totals you are calculating the distinct count of the full data set for january so if NO CONTAINER has only 3 values the total will return 3 you need to make this measure:

 

Total Containers =
IF (
    HASONEFILTER ( Table[Cliente] );
    DISTINCTCOUNT ( Table[NO CONTAINER] );
    SUMX ( ALL ( Table[Cliente] ); DISTINCTCOUNT ( Table[NO CONTAINER] ) )
)

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

6 REPLIES 6
MFelix
Super User
Super User

Hi @Anonymous,

You can add the NO CONTAINER columb to your visuals and select the distinct count summarization or create the following measure

Total containers = DISTINCTCOUNT ( Table[NO CONTAINER] )

Regards
MFelix

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Thanks MFelix, Excellent !!

I have a question: do you know why the totals are not adding up?

Thank you for your attention and collaboration

 

Captura.PNG

 

 

Hi @Anonymous,

 

When you make a measure the calculations for total are make based on context so when you are in the totals you are calculating the distinct count of the full data set for january so if NO CONTAINER has only 3 values the total will return 3 you need to make this measure:

 

Total Containers =
IF (
    HASONEFILTER ( Table[Cliente] );
    DISTINCTCOUNT ( Table[NO CONTAINER] );
    SUMX ( ALL ( Table[Cliente] ); DISTINCTCOUNT ( Table[NO CONTAINER] ) )
)

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Excellent MFelix. You do not know how much you have helped me. Very grateful, very kind

Hi @Anonymous,

 

One thing I forgot, if you want to have a slicer/filter over the Cliente column instead of ALL use ALLSELECTED the rest of the syntax is the same.

 

ALL is gathering all the dataset and going over the filter selections.

 

Regards

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Thanks MFelix

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.