Forum Discussion
Transformed Table Measure
- 6 years ago
Anonymous ,
Ok then! Added a column to check on whether the customer had 1. Here is my pbix. Count of 1 and 2
Sum of 2 = var _code = 2 var _calc = CALCULATE([Sum of Amount],'Count'[Code]=2,'Count'[IF Customer has 1]>=1) return _calc
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel - 6 years ago
Hi Anonymous ,
This is the new Sum of 2, which does not need the Calculated Column. Had to go to another guy on the leaderboards jdbuchanan71 .
Whew!
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
NathanielSum of 2 = VAR _CustList = CALCULATETABLE ( INTERSECT ( CALCULATETABLE ( DISTINCT ( 'Count'[Customer] ), 'Count'[Code] = 1 ), CALCULATETABLE ( DISTINCT ( 'Count'[Customer] ), 'Count'[Code] = 2 ) ), ALLEXCEPT ( 'Count', 'Count'[Customer] ) ) RETURN CALCULATE ( SUM ( 'Count'[Amount] ), 'Count'[Customer] IN ( _CustList ), KEEPFILTERS ( 'Count'[Code] = 2 ) )
Anonymous ,
Ok then! Added a column to check on whether the customer had 1. Here is my pbix. Count of 1 and 2
Sum of 2 = var _code = 2 var _calc = CALCULATE([Sum of Amount],'Count'[Code]=2,'Count'[IF Customer has 1]>=1) return _calc
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
May I ask further, It is possible that not create a column to do so?
- Nathaniel_C6 years ago
Community Champion
Hi Anonymous ,
This is the new Sum of 2, which does not need the Calculated Column. Had to go to another guy on the leaderboards jdbuchanan71 .
Whew!
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
NathanielSum of 2 = VAR _CustList = CALCULATETABLE ( INTERSECT ( CALCULATETABLE ( DISTINCT ( 'Count'[Customer] ), 'Count'[Code] = 1 ), CALCULATETABLE ( DISTINCT ( 'Count'[Customer] ), 'Count'[Code] = 2 ) ), ALLEXCEPT ( 'Count', 'Count'[Customer] ) ) RETURN CALCULATE ( SUM ( 'Count'[Amount] ), 'Count'[Customer] IN ( _CustList ), KEEPFILTERS ( 'Count'[Code] = 2 ) )- Anonymous6 years agoNot applicable
Perfect, exactly what I want, thanks so much
- Anonymous6 years agoNot applicable
Hi Nathaniel_C
This is equation I modified.Sum of 2 (New) = VAR _CustList = CALCULATETABLE ( DISTINCT ( 'Count'[Customer] ), 'Count'[Code] = 1 ) RETURN CALCULATE ( SUM ( 'Count'[Amount] ), 'Count'[Customer] IN ( _CustList ), 'Count'[Code] = 2)I'm so curious why it's empty for (ZZ, Sum of 2 (New) ) and the total is correct, it's very very strange. how come?
- Nathaniel_C6 years ago
Community Champion
Hi Anonymous ,
We ran into the same thing.
Here is the first solution and the subsequent solution that jdbuchanan71 sent. The first one had exactly the same issue. Not sure why.
First one: Measure = VAR _CustList = INTERSECT ( CALCULATETABLE ( DISTINCT ( 'Count'[Customer] ), 'Count'[Code] = 1), CALCULATETABLE ( DISTINCT ( 'Count'[Customer] ), 'Count'[Code] = 2) ) RETURN CALCULATE ( SUM ( 'Count'[Amount] ), 'Count'[Customer] IN ( _CustList ), KEEPFILTERS( 'Count'[Code] = 2 ) ) Second one: Measure = VAR _CustList = CALCULATETABLE( INTERSECT ( CALCULATETABLE ( DISTINCT ( 'Count'[Customer] ), 'Count'[Code] = 1), CALCULATETABLE ( DISTINCT ( 'Count'[Customer] ), 'Count'[Code] = 2) ) ,ALLEXCEPT('Count','Count'[Customer]) ) RETURN CALCULATE ( SUM ( 'Count'[Amount] ), 'Count'[Customer] IN ( _CustList ) ,KEEPFILTERS( 'Count'[Code] = 2 ) )Nathaniel