Forum Discussion
How to sum column based on distinct values from another
- 6 years ago
Hi , GinjaNinja29
You may need to create calculated columns as below:
Count 1 = CALCULATE(COUNT('Original Table'[ID]),ALLEXCEPT('Original Table','Original Table'[ID]))Quantity1 = IF('Original Table'[Count 1]>1,'Original Table'[Quantity],BLANK())The result will show as below:
You also can try to create measure like this:
Quantity 2 = var a= COUNT('Original Table'[ID]) return IF(a>1,CALCULATE(SUM('Original Table'[Quantity])),BLANK())In table visual , make sure the fileld "id" show items with no data
Here is a sample.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
For Avg you do not need to that, You can so like Avg of sum
AverageX(summarize(Table,Table[ID],"_1",sum(Table[Quantity])),[_1])
or
AverageX(values(Table[ID]),sum(Table[Quantity]))
- GinjaNinja296 years agoNew Member
Thank you - I should be more clear.
In one of my visuals, I will be also using this field to count is not blank.
This field will be used to count (is not blank), Sum, Average, and count if >3
- v-easonf-msft6 years ago
Community Support
Hi , GinjaNinja29
You may need to create calculated columns as below:
Count 1 = CALCULATE(COUNT('Original Table'[ID]),ALLEXCEPT('Original Table','Original Table'[ID]))Quantity1 = IF('Original Table'[Count 1]>1,'Original Table'[Quantity],BLANK())The result will show as below:
You also can try to create measure like this:
Quantity 2 = var a= COUNT('Original Table'[ID]) return IF(a>1,CALCULATE(SUM('Original Table'[Quantity])),BLANK())In table visual , make sure the fileld "id" show items with no data
Here is a sample.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.