Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
I have this below table as a sample :
Bank_R | Bank_Date | endtime | delayGroup | IsDeadlinePassed |
4 | 7/6/2020 | 7/7/2020 11:58 | On time | 0 |
19 | 7/6/2020 | 7/7/2020 14:47 | On time | 0 |
19 | 7/6/2020 | 7/7/2020 9:12 | Delayed | 1 |
4 | 7/7/2020 | 7/8/2020 12:50 | On time | 0 |
19 | 7/7/2020 | 7/8/2020 15:16 | On time | 0 |
19 | 7/7/2020 | 7/8/2020 9:56 | Delayed | 1 |
I want to calculate number of days and number of banks which where 'On time' OR whose deadline was not passed which in this case is '0' .
In the table above what I should get as a result is :
No of banks on time = 1 (which is Bank_R = 4 in this case)
No of days on time = 2 (which is 7/6/2020 and 7/7/2020)
Besides this Bank_R and Bank_Date can be taken as user selection from slicers so I don't know if I can do something with Summarize. I am trying to play around with something like this below but it is of no use :
Solved! Go to Solution.
First, let's tackle the number of banks on time. You can use the CALCULATE function combined with DISTINCTCOUNT to count the unique banks that meet the criteria.
For the number of banks on time:
DAX
Copy code
NoOfBanksOnTime =
CALCULATE(
DISTINCTCOUNT('New Table'[Bank_R]),
'New Table'[delayGroup] = "On time" || 'New Table'[IsDeadlinePassed] = 0
)
Next, for the number of days on time, you'd again use CALCULATE but this time with DISTINCTCOUNT on the Bank_Date column.
For the number of days on time:
NoOfDaysOnTime =
CALCULATE(
DISTINCTCOUNT('New Table'[Bank_Date]),
'New Table'[delayGroup] = "On time" || 'New Table'[IsDeadlinePassed] = 0
)
Now, if you want to consider user selections from slicers, the ALLSELECTED function can be useful. However, in the context of your problem, if you're just using slicers on the Bank_R and Bank_Date columns, the above measures should automatically respect those slicer selections without needing to explicitly use ALLSELECTED.
First, let's tackle the number of banks on time. You can use the CALCULATE function combined with DISTINCTCOUNT to count the unique banks that meet the criteria.
For the number of banks on time:
DAX
Copy code
NoOfBanksOnTime =
CALCULATE(
DISTINCTCOUNT('New Table'[Bank_R]),
'New Table'[delayGroup] = "On time" || 'New Table'[IsDeadlinePassed] = 0
)
Next, for the number of days on time, you'd again use CALCULATE but this time with DISTINCTCOUNT on the Bank_Date column.
For the number of days on time:
NoOfDaysOnTime =
CALCULATE(
DISTINCTCOUNT('New Table'[Bank_Date]),
'New Table'[delayGroup] = "On time" || 'New Table'[IsDeadlinePassed] = 0
)
Now, if you want to consider user selections from slicers, the ALLSELECTED function can be useful. However, in the context of your problem, if you're just using slicers on the Bank_R and Bank_Date columns, the above measures should automatically respect those slicer selections without needing to explicitly use ALLSELECTED.
User | Count |
---|---|
12 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
24 | |
19 | |
14 | |
10 | |
7 |