Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Solved! Go to Solution.
Hi @GunnerJ
As tested, when i use the "Earlier" function inside "Filter" function to produce a table, it would throw an error, the same as used in Top N function.
You could understand the "Earlier" meaning from this thread.
When using it in Topn or other formula which finally returns a table, it makes no sense in that case.
You could try the following workaround to get the expected result.
If you have any question, feel free to let me know.
Create measures
SUB =
VAR previous =
CALCULATE (
MIN ( Sheet7[nbr1] ),
FILTER (
ALLSELECTED ( Sheet7 ),
Sheet7[nbr2] = MAX ( Sheet7[nbr2] )
&& Sheet7[cd] = "COMP"
)
)
RETURN
DATEDIFF ( previous, MAX ( Sheet7[tm] ), HOUR )
Or
SUB 2 =
VAR previous =
CALCULATE (
MIN ( Sheet7[nbr1] ),
FILTER (
ALLSELECTED ( Sheet7 ),
Sheet7[nbr2] = MAX ( Sheet7[nbr2] )
&& Sheet7[cd] = "COMP"
)
)
VAR current1 =
CALCULATE ( MAX ( Sheet7[tm] ), ALLSELECTED ( Sheet7 ) )
RETURN
DATEDIFF ( previous, current1, HOUR )
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @GunnerJ
As tested, when i use the "Earlier" function inside "Filter" function to produce a table, it would throw an error, the same as used in Top N function.
You could understand the "Earlier" meaning from this thread.
When using it in Topn or other formula which finally returns a table, it makes no sense in that case.
You could try the following workaround to get the expected result.
If you have any question, feel free to let me know.
Create measures
SUB =
VAR previous =
CALCULATE (
MIN ( Sheet7[nbr1] ),
FILTER (
ALLSELECTED ( Sheet7 ),
Sheet7[nbr2] = MAX ( Sheet7[nbr2] )
&& Sheet7[cd] = "COMP"
)
)
RETURN
DATEDIFF ( previous, MAX ( Sheet7[tm] ), HOUR )
Or
SUB 2 =
VAR previous =
CALCULATE (
MIN ( Sheet7[nbr1] ),
FILTER (
ALLSELECTED ( Sheet7 ),
Sheet7[nbr2] = MAX ( Sheet7[nbr2] )
&& Sheet7[cd] = "COMP"
)
)
VAR current1 =
CALCULATE ( MAX ( Sheet7[tm] ), ALLSELECTED ( Sheet7 ) )
RETURN
DATEDIFF ( previous, current1, HOUR )
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@GunnerJ are you adding this as measure or column? it will not work in measure
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Yes I was trying as a measure. I thought measures were used for multi row context and columns for single row context? I'm trying to compare one time to another so that's why I went with measure. When I switch to column I get the message "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value." I'm only trying to return one value but it will require a few columns to compute.
User | Count |
---|---|
86 | |
82 | |
68 | |
64 | |
55 |
User | Count |
---|---|
120 | |
99 | |
91 | |
83 | |
65 |