Forum Discussion
M Query - If Then Else
- 4 years ago
Hi, AlBud ;
You could try it.
if [ATA Final] = null then List.Average(#"Changed Type"[Port]) else nullThe final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, AlBud ;
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AlBud4 years agoFrequent Visitor
Hi v-yalanwu-msft , Vijay_A_Verma
My data has the "ETA Final Destination Port", and sometimes will have both the "ETA Final Destination Port" and the "ATA Final Destination Port". If my data has the "ATA Final Destination Port" this will be the same date or a later date than the "ETA Final Destination Port". I then want to calculate the average of my "Port To Store" across a number of rows in the same table, then add this to the "ETA Final Destination Port" if the "ATA Final Destination Port" is missing from the table or add the average of my "Port To Store" to the "ATA Final Destination Port". The result will give me a date.
Sample file: https://www.dropbox.com/home/Public#:~:text=https%3A//www.dropbox.com/s/6biikv38i0l24s4/Sample.pbix%3Fdl%3D0
I'd expect in the new column "Est Container Delivery" the highlighted fields below, where I don't have a "ATA Final Delivery" for it to average the "Port To Store" and populate with a date with either the "ETA Final Destination Port" or "ATA Final Destination Port" if populated.