Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi Community! I have an question on how to mimic an Excel if-then-else formula in Power BI. I don't want to use the function in the Excel base table, as I want to let PowerBI do all the work and calculations.
See here an example: I want to assign a certain value to the column "aantal", based in a comparison in the column "DatumTijdTee" of the current and the previous row value. Hope the picture explains better:
Is this a simple function, or do I have to create complicated DAX expressions?
Thanks for your help!
Solved! Go to Solution.
It can also be done in Power Query (M).
Code will be most efficient when you have the relevant current and previous values in 1 row.
This can be done by adding 2 index columns (1 starting with 0 and the other starting with 1) and then merge the table with itself.
An example in this video I created yesterday as an answer to a similar case.
<Hello Marcel,
thanks for the solution, especially the video. This helped me very much with my question!
Cheers, Joop
It can also be done in Power Query (M).
Code will be most efficient when you have the relevant current and previous values in 1 row.
This can be done by adding 2 index columns (1 starting with 0 and the other starting with 1) and then merge the table with itself.
An example in this video I created yesterday as an answer to a similar case.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 97 | |
| 73 | |
| 50 | |
| 46 | |
| 44 |