Forum Discussion

AkashDesai's avatar
AkashDesai
New Member
1 year ago
Solved

Condition Help

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 ...
  • dharmendars007's avatar
    1 year ago

    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

    LinkedIN