This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hi Guys,
I need a help with the case below:
How to write it in Dax or Powerquery a code like this below:
Expected Result =
VAR V_ID = 1
RETURN
if('Table'[OverflowAlarm] = 1 && 'Table'[Previus row] = 0, V_ID,
if('Table'[OverflowAlarm] = 0 && 'Table'[Previus row] = 1, V_ID = V_ID +1 ,
if ('Table'[OverflowAlarm] = 1 && 'Table'[Previus row] = 1, 'Table'[OverflowAlarm],0
)))
I have a table like that:
| Time/date | Point_Id | Index | Duration | OverflowAlarm | Previus row |
| 14/03/2018 23:45 | PDD11148 | 78241 | 15 | 1 | |
| 14/03/2018 23:30 | PDD11148 | 78242 | 15 | 1 | 1 |
| 14/03/2018 23:15 | PDD11148 | 78243 | 15 | 1 | 1 |
| 14/03/2018 23:00 | PDD11148 | 78244 | 15 | 1 | 1 |
| 14/03/2018 22:45 | PDD11148 | 78245 | 15 | 1 | 1 |
| 14/03/2018 22:30 | PDD11148 | 78246 | 15 | 1 | 0 |
| 14/03/2018 22:15 | PDD11148 | 78247 | 0 | 0 | 0 |
| 14/03/2018 22:00 | PDD11148 | 78248 | 0 | 0 | 0 |
| 14/03/2018 21:45 | PDD11148 | 78249 | 0 | 0 | 0 |
| 14/03/2018 21:30 | PDD11148 | 78250 | 0 | 0 | 0 |
| 14/03/2018 21:15 | PDD11148 | 78251 | 0 | 0 | 0 |
| 14/03/2018 21:00 | PDD11148 | 78252 | 0 | 0 | 0 |
| 14/03/2018 20:45 | PDD11148 | 78253 | 0 | 0 | 1 |
| 14/03/2018 20:30 | PDD11148 | 78254 | 15 | 1 | 0 |
| 14/03/2018 20:15 | PDD11148 | 78255 | 0 | 0 | 1 |
| 14/03/2018 20:00 | PDD11148 | 78256 | 15 | 1 | 1 |
| 14/03/2018 19:45 | PDD11148 | 78257 | 15 | 1 | 1 |
| 14/03/2018 19:30 | PDD11148 | 78258 | 15 | 1 | 1 |
| 14/03/2018 19:15 | PDD11148 | 78259 | 15 | 1 | 1 |
| 14/03/2018 19:00 | PDD11148 | 78260 | 15 | 1 | 1 |
And that is the result that I need:
| Point_Id | Index | Duration | OverflowAlarm | Previus row | Expected Result |
| PDD11148 | 78241 | 15 | 1 | event 1 | |
| PDD11148 | 78242 | 15 | 1 | 1 | event 1 |
| PDD11148 | 78243 | 15 | 1 | 1 | event 1 |
| PDD11148 | 78244 | 15 | 1 | 1 | event 1 |
| PDD11148 | 78245 | 15 | 1 | 1 | event 1 |
| PDD11148 | 78246 | 15 | 1 | 0 | event 1 |
| PDD11148 | 78247 | 0 | 0 | 0 | |
| PDD11148 | 78248 | 0 | 0 | 0 | |
| PDD11148 | 78249 | 0 | 0 | 0 | |
| PDD11148 | 78250 | 0 | 0 | 0 | |
| PDD11148 | 78251 | 0 | 0 | 0 | |
| PDD11148 | 78252 | 0 | 0 | 0 | |
| PDD11148 | 78253 | 0 | 0 | 1 | |
| PDD11148 | 78254 | 15 | 1 | 0 | event 2 |
| PDD11148 | 78255 | 0 | 0 | 1 | |
| PDD11148 | 78256 | 15 | 1 | 1 | event 3 |
| PDD11148 | 78257 | 15 | 1 | 1 | event 3 |
| PDD11148 | 78258 | 15 | 1 | 1 | event 3 |
| PDD11148 | 78259 | 15 | 1 | 1 | event 3 |
| PDD11148 | 78260 | 15 | 1 | 1 | event 3 |
Any help is welcome!
Thanks
They've surrounded us. thanks for all you have done
@Anonymous ,
You may take a look at the post below.
Hi,
@v-chuncz-msft wrote:@Anonymous ,
You may take a look at the post below.
Thanks for your response.
I am not a Power Bi expert, I've been working only few weeks with it. But, I couldn't see it working for me. And the function earlier doesn't work well... too many rows in the table, it runs forever... Any other solution?
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 32 | |
| 26 | |
| 21 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 65 | |
| 43 | |
| 28 | |
| 22 | |
| 22 |