Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
Solved! Go to 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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsRegards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks MFelix, Excellent !!
I have a question: do you know why the totals are not adding up?
Thank you for your attention and collaboration
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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsExcellent 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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks MFelix
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 35 | |
| 34 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 137 | |
| 102 | |
| 71 | |
| 67 | |
| 65 |