Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
This has me wanting to throw my laptop out the window and bang my head against a wall.
See image for details, but I'm trying to return the last non blank "production" amount to calculate "missed production" for days where there were down hours. (so first example is ends up being E4/24*D5 and E4/24*D6, and then E10/24*D11)
Using Excel just for illustration purposes.
Thank you,
Eric
Solved! Go to Solution.
Usually, TOPN() is more concise way to handle such scenarios.
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LeanAndPractise(Everyday) ) |
Your solution works as described. I messed up my example dataset though.
My dataset does contain a number in the Production column (between 0-100) even when there is Down Hours. So I'd need it to find the last day that didn't have Down Hours instead of the lastnonblank. I thought I had it when I removed the <= and just made it a < but it got the previous number because it wasn't a blank.
Sorry for messing that up.
Hm... I really doubt it would work by just removing "=" from "<="; you can observe it on 2024/1/18 (or any Down in a row).
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LeanAndPractise(Everyday) ) |
Hi @mgcchkn
First of all, thanks @ThxAlot for your contribution to the forum.
Maybe you can try this:
Create a calculate column in the table:
Missed production =
VAR _previousDate =
IF (
'Table'[Down Date] <> BLANK (),
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER (
ALL ( 'Table' ),
'Table'[Date] < EARLIER ( 'Table'[Date] )
&& 'Table'[Down Date] = BLANK ()
)
)
)
VAR _previousProduction =
CALCULATE (
SELECTEDVALUE ( 'Table'[Production] ),
FILTER ( ALL ( 'Table' ), 'Table'[Date] = _previousDate )
)
RETURN
( _previousProduction / 24 ) * 'Table'[Down Hours]
The result is as follow:
If the above one can't help you, could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for the response! For some reason when I do this, I don't get any results. I'll have to play with it some more to see where I'm going wrong. @ThxAlot 's 2nd solution did work however.
Usually, TOPN() is more concise way to handle such scenarios.
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LeanAndPractise(Everyday) ) |
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
46 | |
26 | |
21 | |
12 | |
8 |
User | Count |
---|---|
75 | |
52 | |
45 | |
15 | |
12 |