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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Custom Replacer.ReplaceText

I have no idea why this is not working.  I am trying to add a custom holiday to my date table.

I get no error code. It acts like it has repaced the value but the cell is empty rather than XXXXXXX. When I sort the "Holiday" column desc the date 2021,4,2 is at the top.  It just has no data in it.

 

#"Sorted Rows" = Table.Sort(#"Added Custom4",{{"Custom", Order.Descending}}),
#"Replaced Value" = Table.ReplaceValue(#"Sorted Rows", each [Holiday], each if [Date] = #date(2021, 4, 2) then "XXXXXXXXXX" else [Holiday], Replacer.ReplaceText,{"Holiday"})
in
#"Replaced Value"

 

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

#"Replaced Value" = Table.ReplaceValue(#"Sorted Rows", each [Holiday], each if [Date] = #date(2021, 4, 2) then "XXXXXXXXXX" else [Holiday], Replacer.ReplaceValue,{"Holiday"})

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

I am not sure why this worked because it appears to be the exact same thing as I was doing but it works.  Thank You Very Much

 

CNENFRNL
Community Champion
Community Champion

#"Replaced Value" = Table.ReplaceValue(#"Sorted Rows", each [Holiday], each if [Date] = #date(2021, 4, 2) then "XXXXXXXXXX" else [Holiday], Replacer.ReplaceValue,{"Holiday"})

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

I am not sure why this worked because it appears to be the exact same thing as I was doing except it worked. Thank You So much

Anonymous
Not applicable

Oh OK!  In that case:

 

 

#"Sorted Rows" = Table.Sort(#"Added Custom4",{{"Custom", Order.Descending}}),

#"Replaced Value" = Table.TransformColumn(#"Added Custom4", {{"Holiday", each if [Date] = #date(2021,4,2) then "XXXXXXXXXX" else [Holiday]}})

 

--Nate

Anonymous
Not applicable

Try transforming the column--because keep in mind, if [Date] is type date, you can't replace it with the text "xxxxxxxx".  If it's a text column., you can't use #date(2021,4,2" as a comparison to the text.  Let's make it a text column so you can add the "XXXXXXXXXX".  

 

#"Sorted Rows" = Table.Sort(#"Added Custom4",{{"Custom", Order.Descending}}),

Table.TransformColumnTypes(#"Sorted Rows", {{"Date", type text}}),
#"Replaced Value" = Table.TransformColumn(#"Added Custom4", {{"Holiday", each if [Date] = "4/2/2021" then "XXXXXXXXXX" else [Date]}})

 

--Nate

Anonymous
Not applicable

Thank you for your reply. The Date column is a date and the Holiday column is text.  I am not trying to change the values in the Date column I am trying to change the values in the Holiday column.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.