Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have a table of measurements above. I want to return the last measurement Value right before the Tank Conditioned column changes to Yes. The highlighted values of 1008 for ASBC and 3.9 for EBC would be the correct result. I'm not sure if this is best done in a measure or a calculated column and I can't figure out how to get this done.
OK, I used a combination of solutions here to get it to work half the time.
This works for when there is a production order that goes from Tank Conditioned = No to Yes. However, I can't figure out yet how to return the last values for brands that never go from No to Yes.
HEre is what I have so far.
Hi @cbruhn42 ,
Please crate a calculate column like:
Last Value =
VAR CurrentOrder = 'Table'[JFProductionOrder]
VAR CurrentAttribute = 'Table'[Attribute]
VAR Dt = 'Table'[Turbidity DT]
RETURN
IF(
'Table'[Tank Conditioned] = "No",
CALCULATE(
LASTNONBLANK('Table'[Value],1),
FILTER(
ALL('Table'),
'Table'[JFProductionOrder] = CurrentOrder &&
'Table'[Attribute] = CurrentAttribute &&
'Table'[Turbidity DT] < Dt &&
'Table'[Tank Conditioned] <> "Yes"
)
)
)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
This doesn't quiet work. If I only have one measurement set with before the tank is conditioned I get blank values.
If I have a brand that never switches to Tank Conditioned = Yes, then I get the incorrect values.
WE're close though! Thank you for the help.
Forgot to add that I do have a date column. It is the date/time the tank is conditioned. Basically when the 'Tank Conditioned' column goes from No to Yes it uses this date column to determine that.
@cbruhn42 , I think we need to have a date or index column to find data less than this, but you can try like
New column = maxx(filter(Table, [Attribute] = earlier([Attribute]) && [Tank Condition] = "No") , [Value])
or
New column = if([Tank Condition] = ""Yes" , maxx(filter(Table, [Attribute] = earlier([Attribute]) && [Tank Condition] =
"No") , [Value]) , blank())
refer
Power BI DAX- Earlier, I should have known Earlier: https://www.youtube.com/watch?v=cN8AO3_vmlY&t=17820s&list=PLPaNVDMhUXGYU97pdqwoaociLdwyDRn39&index=1
@amitchandak, do you have another idea now that I submitted the additional information regarding date column?
Definately need a date here I think to get this to work right. Here is a snapshot of the table with the dates I have available. The other piece I forgot to mention is that there are multiple production orders this occurs on in the data set. So the values returned are specific to that production order that starts with MR.
User | Count |
---|---|
93 | |
84 | |
78 | |
75 | |
66 |
User | Count |
---|---|
115 | |
105 | |
93 | |
65 | |
60 |