powerbicustomcolumn

Custom column for different days


I'm using DirectQuery and i want to calculate the start date - end date without the weekend (Friday and Saturday) through a custom column. Can you help me?

I want you to solve the problem according to the specifications I told you


Solution

  • Refer to the DAX NETWORKDAYS function.

    It would look similar to:

    My New Column = NETWORKDAYS([start date], [end date], 7)
    

    And if it doesn't work for DirectQuery, then you will need to use a Measure instead. That could like this:

    My New Measure = 
      var r = SUMX(
        'Your Table Name',
        NETWORKDAYS( [start date], [end date], 7 )
      ) 
      return IF( r < 0, 0, r)