Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register 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.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 76 | |
| 36 | |
| 31 | |
| 29 | |
| 26 |