Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Having the above table where delta is the difference between curent timestamp and previous one, I want to calculate the column for the far right. Which function should I use, or how can I approach this? Doesn't matter if it is DAX or Power M query.
Thanks!
Solved! Go to Solution.
Ah yeah, sorry.
Try it with an equals sign as well as the "<":
Column = "Observation "&CALCULATE(COUNTROWS(Table1),ALLEXCEPT(Table1,Table1[id]),Table1[timestamp]<=EARLIER(Table1[timestamp]),Table1[delta]>2)+1
Alex
Hi @DanielV91
Try this formula
calculated column = IF ( [delta] > 2, "Observation2", "Observation1" )
Best Regards
Maggie
Thanks for replying but that formula will not work. I will end up having "Observation 1" for everything except the rows where delta is greater than 2.
The observations need to be incremented when delta greater than 2 is found for the same ID while going down the table. Also, when the ID changes, observations need to start again / reset.
My programing logic is like this:
Hi Daniel,
I think the following calculated column will do the job for you.
Can you try it and let me know how you get on (obviously replacing table and column names with your own):
Column = "Observation "&CALCULATE(COUNTROWS(Table1),ALLEXCEPT(Table1,Table1[id]),Table1[timestamp]<EARLIER(Table1[timestamp]),Table1[delta]>2)+1
Hope that helps,
Alex
@alexei7 thanks for replying! It is very close, but the ones where delta is greater than 2 should have asigned the next number.
Basically for the ones that I marked with red should be '2'.
Ah yeah, sorry.
Try it with an equals sign as well as the "<":
Column = "Observation "&CALCULATE(COUNTROWS(Table1),ALLEXCEPT(Table1,Table1[id]),Table1[timestamp]<=EARLIER(Table1[timestamp]),Table1[delta]>2)+1
Alex
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 69 | |
| 63 | |
| 32 | |
| 31 | |
| 23 |