The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi I have two tables the firstone is a changelog called 'Activity' the second one is a table called 'Dates' wich dertermines the deadlines by zone.
This is an extract of the first table
Index | TimeStamp | IssueAction | ZONE_JCS |
1 | 12-03-21 | Edited | Z09 |
1 | 09-03-21 | Reactivated | Z09 |
1 | 23-11-22 | Reopened | Z09 |
1 | 14-04-21 | Reopened | Z09 |
1 | 13-04-21 | Closed | Z09 |
1 | 06-04-21 | Edited | Z09 |
1 | 24-02-21 | Edited | Z09 |
1 | 03-03-21 | Edited | Z09 |
2 | 22-04-21 | Edited | Z03 |
2 | 19-02-21 | Reactivated | Z03 |
2 | 19-02-21 | Resolved | Z03 |
2 | 19-02-21 | Resolved | Z03 |
2 | 04-03-21 | Edited | Z03 |
2 | 26-02-21 | Edited | Z03 |
2 | 09-03-21 | Closed | Z03 |
2 | 23-02-21 | Edited | Z03 |
2 | 17-02-21 | Created | Z03 |
2 | 25-02-21 | Edited | Z03 |
This is the whole second one
ZONE | PLANNING |
Z01 | 18-09-21 |
Z02 | 04-08-21 |
Z03 | 05-12-22 |
Z04 | 06-12-22 |
Z05 | 07-12-22 |
Z06 | 08-12-22 |
Z07 | 09-12-22 |
Z08 | 10-12-22 |
Z09 | 11-12-22 |
Z10 | 12-12-22 |
Z11 | 13-12-22 |
Z12 | 14-12-22 |
Z13 | 15-12-22 |
Z14 | 16-12-22 |
Z15 | 17-12-22 |
Z16 | 18-12-22 |
Z17 | 19-12-22 |
I'm trying to add a 3rd colonne in the second table with the values of the closed 'Index' at the given date by the 'Planning' column for every zone.
If I had to acomplish these task manually I'd proceed as follows:
1. I filter the table 'Activity' by Zone
2. Filter the table 'Activity ' by 'TimeStamp' taking only dates before the date given by the "Planning" and "Zone".
3. Take the earliest TimeStamp of every Index.
4. Count the total number of filtered rows whose 'IssueAction' is equal to 'Closed'
5. Repeat the same operation for each Zone.
I have written this DAX code but it seems to be filtering the 'IssueAction' before taking the earliest date of every 'Index'.
newColumn =
VAR currZone = Dates[ZONE]
VAR currDate = Dates[Planning]
RETURN
CALCULATE(
DISTINCTCOUNT('Activity (P-B6G-CIV-BGTF)'[Index]),
FILTER(
'Activity (P-B6G-CIV-BGTF)',
'Activity (P-B6G-CIV-BGTF)'[Zone_JCS] = currZone &&
'Activity (P-B6G-CIV-BGTF)'[TimeStamp] <= currDate &&
'Activity (P-B6G-CIV-BGTF)'[IssueAction] = "Closed" &&
'Activity (P-B6G-CIV-BGTF)'[TimeStamp] =
CALCULATE(
MIN('Activity (P-B6G-CIV-BGTF)'[TimeStamp]),
'Activity (P-B6G-CIV-BGTF)'[Index] = EARLIER('Activity (P-B6G-CIV-BGTF)'[Index])
)
)
)
Could somebody help me please?
My first explanation was perhaps a little complex.
I have created two simplified tables to try to make my explanation clearer.
Hi I have a two table in Power BI.
Table 'Activity':
The other table is called 'Dates':
I need to add a column in the Dates table called 'Closed Issues at planning date by zone':
The resulting column is the result of using the Planning dates in Dates table as a cutoff date. After that we take the moste recent date in the 'DateOfIssueAction' of each Issue with the same number and the same Zone. After that we take the number of lines with the word 'Closed' in the IssueAction field.
The resulting table after adding the new column would be this:
Does anyone have any idea how to do it with DAX or Power Query?
I leave the simplified file in the following link:
https://we.tl/t-GK6hssGVPN
Thank you in advance.
hi @Thrasso00
try like:
hi @Thrasso00
could you enrich your data of Activity table to better reflect your case?
Is it not allowed to provide the two excel files in this forum?
Does anyone have an idea how to do this?
May be another approach?
Upload to any cloud service like onedrive or dropbox and share the link
User | Count |
---|---|
17 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |