Forum Discussion
Power Query formula for calculating if condition and calculate count from another table
- 2 years ago
619SK I put this solution together. Might be correct I suppose. I did some things in Power Query but the rest is DAX. See PBIX attached below signature. Really the only Power Query is unpivoting your point logic columns.
Open = VAR __AgeCategory = MAX( 'PointLogic'[Attribute] ) VAR __Table = ADDCOLUMNS( 'Table', "AgeCategory", SWITCH( TRUE(), [Ageing] < 16, "0-15", [Ageing] < 31, "16-30", [Ageing] < 91, "31-90", ">90" ) ) VAR __Result = COUNTROWS( FILTER( __Table, [AgeCategory] = __AgeCategory ) ) + 0 RETURN __result Points = VAR __Open = [Open] VAR __AgeCategory = MAX( 'PointLogic'[Attribute] ) VAR __Result = MAXX( FILTER( 'PointLogic', [No of Count] = __Open && [Attribute] = __AgeCategory ), [Value] ) RETURN __Result
Still unclear to me.
- what do you mean by "number of break"?
- What would your expected results be using the data you posted in your original question?
Break i mean count of open status
Please find below result as seprate control wise.
| A | ||
| Age_Category | Open | Point |
| 0-15 | 0 | 100 |
| 16-30 | 0 | 100 |
| 31>90 | 1 | 100 |
| >90 | 1 | 90 |
| B | ||
| Age_Category | Open | Point |
| 0-15 | 0 | 100 |
| 16-30 | 0 | 100 |
| 31>90 | 2 | 80 |
| >90 | 0 | 100 |
| C | ||
| Age_Category | Open | Point |
| 0-15 | 0 | 100 |
| 16-30 | 1 | 100 |
| 31>90 | 0 | 100 |
| >90 | 0 | 100 |
| D | ||
| Age_Category | Open | Point |
| 0-15 | 0 | 100 |
| 16-30 | 1 | 100 |
| 31>90 | 0 | 100 |
| >90 | 0 | 100 |
- Greg_Deckler2 years agoCommunity Champion
619SK I put this solution together. Might be correct I suppose. I did some things in Power Query but the rest is DAX. See PBIX attached below signature. Really the only Power Query is unpivoting your point logic columns.
Open = VAR __AgeCategory = MAX( 'PointLogic'[Attribute] ) VAR __Table = ADDCOLUMNS( 'Table', "AgeCategory", SWITCH( TRUE(), [Ageing] < 16, "0-15", [Ageing] < 31, "16-30", [Ageing] < 91, "31-90", ">90" ) ) VAR __Result = COUNTROWS( FILTER( __Table, [AgeCategory] = __AgeCategory ) ) + 0 RETURN __result Points = VAR __Open = [Open] VAR __AgeCategory = MAX( 'PointLogic'[Attribute] ) VAR __Result = MAXX( FILTER( 'PointLogic', [No of Count] = __Open && [Attribute] = __AgeCategory ), [Value] ) RETURN __Result- 619SK2 years agoHelper II
Point column total is not coming as sum of value how can I convert to summarise format