Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have been really struggling with a concept to build a report which matches the requirements:
Number of installers with 0 claims
Number of installers with 1 claim
Number of Installer with 2 or more claims
This also needs to be affected by a time slicer.
The data I have is:
Users
UserId |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Claims
Id | Date | UserId |
1 | 01/01/2022 | 2 |
2 | 27/01/2022 | 1 |
3 | 02/02/2022 | 2 |
4 | 20/03/2022 | 7 |
In the report one table we are trying to show is:
Count of userid | Claim bracket |
4 | 0 |
2 | 1 |
1 | 2+ |
Really hoping someone can help 🙂
Regards,
Oli
Solved! Go to Solution.
The simplest way would be to create 3 different measures for that with the following logic:
SUMX(Users, IF(COUNTROWS(RELATEDTABLE(Claims)) = 0, 1, 0)
This will sum up all the users that have no claims during the slicer-selected time period.
Hi, @oliharford, @JirkaZ
I believe I figured it out. The solution requires only one measure and Brackets Dimension Table:
Brackets =
var table___ = SUMMARIZE(Claims, Users[UserId ], "CountOfRequest", COUNTA(Claims[UserId]))
var _Add_ = ADDCOLUMNS(table___, "UserIDUnique", Users[UserId ], "CountOfRequestPerUser", [CountOfRequest], "Brackets_", SWITCH(TRUE(), [CountOfRequest] >= 2, "2+", [CountOfRequest] = 1, "1", "0"))
var currentBrackets = MAX(ClaimBrackets[Brackets])
var AllUsers = COUNTROWS(VALUES(Users[UserId ]))
var UsersWith2Plus = COUNTROWS(FILTER(_Add_, [CountOfRequest]>=2))
var UsersWith1 = COUNTROWS(FILTER(_Add_, [CountOfRequest]=1))
var UserWith0 = AllUsers - (UsersWith2Plus + UsersWith1)
var returnCount = SWITCH(TRUE(),
currentBrackets = "2+", UsersWith2Plus,
currentBrackets = "1", UsersWith1,
UserWith0)
return returnCount
Hi, @oliharford, @JirkaZ
I believe I figured it out. The solution requires only one measure and Brackets Dimension Table:
Brackets =
var table___ = SUMMARIZE(Claims, Users[UserId ], "CountOfRequest", COUNTA(Claims[UserId]))
var _Add_ = ADDCOLUMNS(table___, "UserIDUnique", Users[UserId ], "CountOfRequestPerUser", [CountOfRequest], "Brackets_", SWITCH(TRUE(), [CountOfRequest] >= 2, "2+", [CountOfRequest] = 1, "1", "0"))
var currentBrackets = MAX(ClaimBrackets[Brackets])
var AllUsers = COUNTROWS(VALUES(Users[UserId ]))
var UsersWith2Plus = COUNTROWS(FILTER(_Add_, [CountOfRequest]>=2))
var UsersWith1 = COUNTROWS(FILTER(_Add_, [CountOfRequest]=1))
var UserWith0 = AllUsers - (UsersWith2Plus + UsersWith1)
var returnCount = SWITCH(TRUE(),
currentBrackets = "2+", UsersWith2Plus,
currentBrackets = "1", UsersWith1,
UserWith0)
return returnCount
The simplest way would be to create 3 different measures for that with the following logic:
SUMX(Users, IF(COUNTROWS(RELATEDTABLE(Claims)) = 0, 1, 0)
This will sum up all the users that have no claims during the slicer-selected time period.
Amazing thank you for this, such a simple solution for something i have really struggled with.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
94 | |
75 | |
62 | |
50 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |