Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Look at this table,
Suppose I have given only three column Pot. No, Date, Shift.
And this data gets appended every eight hours so you can see there are three shifts given over there so here I have to create the last column which is shift type, And in shift type I have to write dynamic dax, dynamic dax basically means the last shift would be latest shift. so first shift is shift 1 , second is shift 2 and 3rd is three respective to date.
I have written this dax but it doesn't work
Shift type = if(Fact_Table[date] = MAX(Fact_Table[date]),IF(Fact_Table[time - Copy.2 - Copy]=max(Fact_Table[time - Copy.2 - Copy]),"Latest Shift","Not the latest Shift")
please help
@amitchandak @Greg_Deckler
Pot No | Date | Shift | Shift type |
B9 | 26/11/2022 | 3 | Latest Shift |
B10 | 26/11/2022 | 3 | Latest Shift |
B11 | 26/11/2022 | 3 | Latest Shift |
B12 | 26/11/2022 | 3 | Latest Shift |
B13 | 26/11/2022 | 3 | Latest Shift |
A1 | 25/11/2022 | 1 | Not the latest shift |
A2 | 25/11/2022 | 1 | Not the latest shift |
A3 | 25/11/2022 | 1 | Not the latest shift |
A4 | 25/11/2022 | 1 | Not the latest shift |
A5 | 25/11/2022 | 2 | Not the latest shift |
A6 | 25/11/2022 | 2 | Not the latest shift |
A7 | 25/11/2022 | 2 | Not the latest shift |
A8 | 25/11/2022 | 2 | Not the latest shift |
A9 | 25/11/2022 | 3 | Not the latest shift |
A10 | 25/11/2022 | 3 | Not the latest shift |
A11 | 25/11/2022 | 3 | Not the latest shift |
A12 | 25/11/2022 | 3 | Not the latest shift |
A13 | 25/11/2022 | 3 | Not the latest shift |
A1 | 26/11/2022 | 1 | Not the latest shift |
A2 | 26/11/2022 | 1 | Not the latest shift |
A3 | 26/11/2022 | 1 | Not the latest shift |
A4 | 26/11/2022 | 1 | Not the latest shift |
A5 | 26/11/2022 | 2 | Not the latest shift |
A6 | 26/11/2022 | 2 | Not the latest shift |
B7 | 26/11/2022 | 2 | Not the latest shift |
B8 | 26/11/2022 | 2 | Not the latest shift |
Solved! Go to Solution.
Hi @RavirajMSE ,
you can try this measure
Measure =
VAR MaxDate= CALCULATE(MAX('Table'[Date]),ALL('Table'))
VAR MaxShift = CALCULATE(MAX('Table'[Shift]),ALL('Table'))
RETURN
SWITCH(TRUE(),
SELECTEDVALUE('Table'[Date]) = MaxDate && SELECTEDVALUE('Table'[Shift]) = MaxShift, "Latest Shift",
"Not the latest Shift"
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @RavirajMSE ,
you can try this measure
Measure =
VAR MaxDate= CALCULATE(MAX('Table'[Date]),ALL('Table'))
VAR MaxShift = CALCULATE(MAX('Table'[Shift]),ALL('Table'))
RETURN
SWITCH(TRUE(),
SELECTEDVALUE('Table'[Date]) = MaxDate && SELECTEDVALUE('Table'[Shift]) = MaxShift, "Latest Shift",
"Not the latest Shift"
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Shift type = if(Fact_Table[date] = MAX(Fact_Table[date])&&IF(Fact_Table[shift]=MAX(Fact_Table[shift]),"latest shift","not the latest shift"))
This one also doesn't work
@amitchandak @Greg_Deckler @Jihwan_Kim @Navneet_Kaur @mangaus1111 @Mikelytics
Adding the table once again, above one seems confusing
Pot No | Date | Shift | Shift type | |
B9 | 26/11/2022 | 3 | Latest Shift | |
B10 | 26/11/2022 | 3 | Latest Shift | |
B11 | 26/11/2022 | 3 | Latest Shift | |
B12 | 26/11/2022 | 3 | Latest Shift | |
B13 | 26/11/2022 | 3 | Latest Shift | |
A1 | 25/11/2022 | 1 | Not the latest shift | |
A2 | 25/11/2022 | 1 | Not the latest shift | |
A3 | 25/11/2022 | 1 | Not the latest shift | |
A4 | 25/11/2022 | 1 | Not the latest shift | |
A5 | 25/11/2022 | 2 | Not the latest shift | |
A6 | 25/11/2022 | 2 | Not the latest shift | |
A7 | 25/11/2022 | 2 | Not the latest shift | |
A8 | 25/11/2022 | 2 | Not the latest shift | |
A9 | 25/11/2022 | 3 | Not the latest shift | |
A10 | 25/11/2022 | 3 | Not the latest shift | |
A11 | 25/11/2022 | 3 | Not the latest shift | |
A12 | 25/11/2022 | 3 | Not the latest shift | |
A13 | 25/11/2022 | 3 | Not the latest shift | |
A1 | 26/11/2022 | 1 | Not the latest shift | |
A2 | 26/11/2022 | 1 | Not the latest shift | |
A3 | 26/11/2022 | 1 | Not the latest shift | |
A4 | 26/11/2022 | 1 | Not the latest shift | |
A5 | 26/11/2022 | 2 | Not the latest shift | |
A6 | 26/11/2022 | 2 | Not the latest shift | |
B7 | 26/11/2022 | 2 | Not the latest shift | |
B8 | 26/11/2022 | 2 | Not the latest shift |
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
73 | |
57 | |
38 | |
35 |
User | Count |
---|---|
83 | |
68 | |
59 | |
46 | |
45 |