Forum Discussion
Create two list from same parent table with difference conditon.
- 1 year ago
Hi,
PBI file attached.
Hope this helps.
Dear AshishTanwar88 ,
Try below steps:
Load the Data:
Load the source table into Power BI.
Create Two Date Slicers:
Add a slicer for AttendanceDate in the Power BI report. Duplicate this slicer to create two independent slicers for Date Filter 1 and Date Filter 2
Create Calculated Tables:
Use DAX to create two calculated tables for Result Table 1 and Result Table 2.
DAX for Result Table 1
This table includes employees present on Date Filter 1 but absent on Date Filter 2:
ResultTable1 =
VAR FilterDate1 = SELECTEDVALUE(SlicerTable1[AttendanceDate])
VAR FilterDate2 = SELECTEDVALUE(SlicerTable2[AttendanceDate])
RETURN
FILTER(
MainTable,
MainTable[AttendanceDate] = FilterDate1 &&
NOT(MainTable[Em ID] IN
CALCULATETABLE(
VALUES(MainTable[Em ID]),
MainTable[AttendanceDate] = FilterDate2
)
)
)
DAX for Result Table 2
This table includes employees present on Date Filter 2 but absent on Date Filter 1:
ResultTable2 =
VAR FilterDate1 = SELECTEDVALUE(SlicerTable1[AttendanceDate])
VAR FilterDate2 = SELECTEDVALUE(SlicerTable2[AttendanceDate])
RETURN
FILTER(
MainTable,
MainTable[AttendanceDate] = FilterDate2 &&
NOT(MainTable[Em ID] IN
CALCULATETABLE(
VALUES(MainTable[Em ID]),
MainTable[AttendanceDate] = FilterDate1
)
)
)
Add the Tables to the Report:
- Use a table visual in Power BI to display the data from Result Table 1 and Result Table 2.
-
Customize the Report:
Add titles and labels to clearly indicate what each table represents.
Result
- Result Table 1: Displays employees present on Date Filter 1 but absent on Date Filter 2 (e.g., Martin)
- Result Table 2: Displays employees present on Date Filter 2 but absent on Date Filter (e.g., Lora)
Please mark this as solution if it helps you. Appreciate Kudos.
Thanks for your response on this, I am following your solution but some how it is not working at my end, below is my DAXs to create the tables:
ResultTable1 =
VAR FilterDate1 = SELECTEDVALUE(Messages[MessageDateOnly])
VAR FilterDate2 = SELECTEDVALUE(Messages[MessageDateOnly])
RETURN
FILTER(
Messages,
Messages[MessageDateOnly] = FilterDate1 &&
NOT(Messages[DealerNumberID] IN
CALCULATETABLE(
VALUES(Messages[DealerNumberID]),
Messages[MessageDateOnly] = FilterDate2
)
)
)
ResultTable2 =
VAR FilterDate1 = SELECTEDVALUE(Messages[MessageDateOnly])
VAR FilterDate2 = SELECTEDVALUE(Messages[MessageDateOnly])
RETURN
FILTER(
Messages,
Messages[MessageDateOnly] = FilterDate2 &&
NOT(Messages[DealerNumberID] IN
CALCULATETABLE(
VALUES(Messages[DealerNumberID]),
Messages[MessageDateOnly] = FilterDate1
)
)
)
Any views on this?