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.
Hi,
I am trying to add consecutive punch hours in consecutive hours column if the difference between the current row and the previous row is less than 1.5. I have already added an index column and I am using the Sumx formula given below. I am however getting an error with the calculation as can be seen here. Can anyone please let me know what the issue might be and what can be done?
Hi @Vatz8 ,
A simple workaround, change the earlier(vm_moc[employee]) to max(vm_moc[employee]).
Try this code:
Consecutive hours =
SUMX (
FILTER (
ALLSELECTED ((vw_moc),
vw_moc[employee] = max ( vw_moc[employee] )
&& (
LOOKUPVALUE ( vw_moc[TimeDifference], vw_moc[Index], vw_moc[Index] )
- LOOKUPVALUE ( vw_moc[TimeDifference], vw_moc[Index], vw_moc[Index] - 1 )
) < 1.5
&& vw_moc[Index]
> LOOKUPVALUE ( vm_moc[TimeDifference], vw_moc[Index], vw_moc[Index] - 1 )
),
vw_moc[punch_hours]
)
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This formula is returning with an error, probably due to the allselected()
First, you should refrain from using
Use variables instead. Please go to EARLIER – DAX Guide and peruse the article. Then change your code accordingly.
Also, please refrain from using one-table models. Such a (bad) practice will create so many problems in no time that you'll be forced into doing it the right way anyway (and will be wasting time). Please read about how to create correct models that in fact do calculate what you want them to instead of giving you - RANDOMLY - wrong figures: Understand star schema and the importance for Power BI … (bing.com)
Hi,
can you please provide a solution to this problem?
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 |
---|---|
44 | |
28 | |
21 | |
12 | |
8 |
User | Count |
---|---|
74 | |
51 | |
45 | |
16 | |
12 |