Forum Discussion
Nicpet0
1 year agoFrequent Visitor
Calculating unique combination from different tables
Hi Community I am facing an issue in Power Bi with a DAX measure i am trying to create. (See below the pasted code, as it looks currently) I am trying to count each occurence of the unique comb...
- 1 year ago
I think your code just needs a little tweak
Count of Negative Margin = VAR Groups = SUMMARIZECOLUMNS ( 'Variant'[Variant Item No], 'Variant'[Variant Code], 'Sales Person'[Sales Person Name], "@gross margin", [Gross Margin 2 %] ) RETURN COUNTROWS ( FILTER ( Groups, [@gross margin] < 0 ) )By including the measure in the SUMMARIZECOLUMNS you will only return combinations of item no, code and sales person which have made sales, rather than all possible combinations which your original code would do. You can then filter that for values below 0.
- 1 year ago
Thanks, that did the trick!
johnt75
Super User
1 year agoI think your code just needs a little tweak
Count of Negative Margin =
VAR Groups =
SUMMARIZECOLUMNS (
'Variant'[Variant Item No],
'Variant'[Variant Code],
'Sales Person'[Sales Person Name],
"@gross margin", [Gross Margin 2 %]
)
RETURN
COUNTROWS ( FILTER ( Groups, [@gross margin] < 0 ) )
By including the measure in the SUMMARIZECOLUMNS you will only return combinations of item no, code and sales person which have made sales, rather than all possible combinations which your original code would do. You can then filter that for values below 0.
- Nicpet01 year agoFrequent Visitor
Thanks, that did the trick!