Autoincrement in DAX depending on a date

Viewed 167

I am trying to add a new table in PowerBi using DAX. This column should be an autoincrement index but only for some specific days of the week. This would be and example of the column I am trying to add:

enter image description here

I have tried to use a GENERATESERIES with some filters, but I was not able to do it.

Can you help me?

Thank you very much

1 Answers

You can create a new column like this (DAX):

Incremental = var __curDay = [Date] var __curDAYName = [DAYNAME] return
if(__curDAYName in {1,3,4},CALCULATE(COUNTROWS(VALUES(CAL[Date])), FILTER(ALL(CAL),  CAL[Date] <= __curDay && [DAYNAME] in {1,3,4})),BLANK())

enter image description here

Related