Forum Discussion

WildIOM123's avatar
WildIOM123
Regular Visitor
2 years ago
Solved

Help with a rule please

Hi, I am looking for help with a rule set in Power BI which gives us the load factor of vessels.    the current rule is:  = Table.AddColumn(#"Grouped Rows", "Custom", each if [VesselName] = "Vesse...
  • MFelix's avatar
    2 years ago

    Hi WildIOM123 ,

     

    You need to update your code to something similar to this:

     

    = Table.AddColumn(#"Grouped Rows", "Custom", each if [VesselName] = "Vessel 1" then 620 else if [VesselName] = "Vessel 2" and [Date] <=   #date(2024, 3, 31) then 600 else if [VesselName] = "Vessel 2" and[Date] >=   #date(2024, 4, 1) then 900 else if [VesselName] = "Vessel 3" then 871 else null)

     

    The [Date] is the column on the table that has the date you want to compare.