Forum Discussion
619SK
2 years agoHelper II
Power Query formula for calculating if condition and calculate count from another table
Hi I have around 20+ controls from each sharepoint, i need to calculate count with open status and give point as per ageing per the rules. i have appended all 20+ control into 1 table with two colu...
- 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
619SK
2 years agoHelper II
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_Deckler
2 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