Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have a table shown below. What I want to do is sum the "Piece Count" column values only if values in "Tag No" column are equal.
Afterwards, I want to distinct count number of Tag No (Rows) where Std Pc Count and Piece Count are not equal. Please help.
Solved! Go to Solution.
Hello @AkashDesai ,
You can create a calculated column to sum the "Piece Count" where the "Tag No" is the same.
TotalPieceCountByTagNo =
CALCULATE(
SUM(TableName[Piece Count]),ALLEXCEPT(TableName, TableName[Tag No]))
Next, you can create a measure to count distinct "Tag No" where the total "Piece Count" differs from the "Std Pc Count".
This measure filters the rows where the total piece count for a "Tag No" does not match the "Std Pc Count" and then performs a distinct count of those "Tag No" values
DistinctCountOfTagNo =
CALCULATE(
DISTINCTCOUNT(TableName[Tag No]),
FILTER(
TableName,TableName[TotalPieceCountByTagNo] <> TableName[Std Pc Count]))
If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes 👍 are much appreciated!
Thank You
Dharmendar S
Hello @AkashDesai ,
You can create a calculated column to sum the "Piece Count" where the "Tag No" is the same.
TotalPieceCountByTagNo =
CALCULATE(
SUM(TableName[Piece Count]),ALLEXCEPT(TableName, TableName[Tag No]))
Next, you can create a measure to count distinct "Tag No" where the total "Piece Count" differs from the "Std Pc Count".
This measure filters the rows where the total piece count for a "Tag No" does not match the "Std Pc Count" and then performs a distinct count of those "Tag No" values
DistinctCountOfTagNo =
CALCULATE(
DISTINCTCOUNT(TableName[Tag No]),
FILTER(
TableName,TableName[TotalPieceCountByTagNo] <> TableName[Std Pc Count]))
If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes 👍 are much appreciated!
Thank You
Dharmendar S
Dharmendra, thanks for your help. Your answer helped me to get better at syntax and solved my problem partially. Although I have one more catch which I came across just now. See the following example where I have same tag no being duplicated twice. So, before I use your first measure, I need to get rid of this duplication in such a way that I still count it once. How will that be possible? In this case, piece count is matching with std pc count so it's a right entry but need to consider it only once.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
8 | |
8 |
User | Count |
---|---|
13 | |
12 | |
11 | |
10 | |
8 |