Join 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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have a database I connect using Power Query, which brings in monthly data for analyzation and reporting. In some months I have a Revenue Code that may show up or may not. What I would like to do is create an IF function that looks for this Code and inserts a row for that Code if not present.
My current line of code: = Table.InsertRows(#"Reordered Columns", 2, {[Revenue Code="104", Date= null, kWh= null, kW= null, Charges= null, Tax= null, Total= null]})
But the problem is in months that Code 104 is created, it doubles the count further in queries. SO my thoughts were to create an If function that crerates the above data if the code is missing but ignores it if it is present.
Thank you for any assistance.
This would be much easier to solve with some sample data.
You could possibly just add a grouping to deal with the duplicate rows.
So, group by everything you need to and do a max or sum of the Date, kWh, KW, Charges etc. as required.
This should give you what you want. Again, can't be sure without seeing some sample data.
| Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 7 | |
| 6 |