Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
MagnusErler
Helper I
Helper I

Add value to only one distinct date

I want to add a "1" in the beginning of each day and only once. 

rmd_date  I want to create this column
12-04-2023  0
12-04-2023  1
11-04-2023  0
11-04-2023  0
11-04-2023  1
10-04-2023  1
9-04-2023  0
9-04-2023  0
9-04-2023  1

 

7 REPLIES 7
DOLEARY85
Super User
Super User

Okay to do this:

 

First i would sort the order of you date field ascending then add an index in power query.

 

then create a column in DAX:

 

Column 2 =
IF (CALCULATE (COUNTROWS ('Table (4)'),FILTER (ALLEXCEPT ( 'Table (4)', 'Table (4)'[Date] ),'Table (4)'[Index] <= EARLIER ('Table (4)'[Index] )))> 1, 0, 1)
 
DOLEARY85_0-1681302779286.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Thank you for your resposse. It however doesn't seem to work...
My line:

IF( CALCULATE( COUNTROWS( MG_casing_record, FILTER( ALLEXCEPT (MG_casing_record, MG_casing_record[rmd_date]), MG_casing_record[id] <= EARLIER (MG_casing_record[id]))) > 1, 0, 1))

It gives me this warning: "Too many arguments were passed to the COUNTROWS function. The maximum argument count for the function is 1."

Hmmm okay, try changing the COUNTROWS  to COUNT

This also doesn't seem to work... Could you send me the PBI-file? 🙂

I don't seem to be able to share the file, i'm getting an unsupported message. Do you have a share drive i can drop it in?

DOLEARY85
Super User
Super User

Hi, you could use a calculated column with DAX,

 

i've assumed the 1 and 0 depends on whether you want a day adding or not if so:

 

Column = if(VALUE('Table (4)'[Value])=1,DATEADD('Table (4)'[Date],1,DAY))
 
DOLEARY85_3-1681301132829.png

 

 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Thank you. I have updated the question. Hope it makes more sense now 🙂

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.