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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
madkow
Frequent Visitor

Added a custom field in Advanced Editor but not usable in relationships

In short, I added a custom date field in the Advanced Editor (M Query) and used it to filter rows

let
    Source = opportunities,
#"Added Opp Date" = Table.AddColumn(#"Changed Type1", "Opp Date", each if [Opportunity State] = "Open" then [Estimated Close Date] else [Actual Close Date]), AddedFilterPY = Table.AddColumn(#"Added Opp Date", "Greater Than Prev Year", each if Date.Year([Opp Date]) >= Date.Year(Date.AddYears(DateTime.LocalNow(),-1)) then "True" else "False"), #"Filtered PY" = Table.SelectRows(AddedFilterPY, each ([Greater Than Prev Year] = "True")),

Basically, a conditional date field shows depending on the Opportunity State.  I then use this to only get the prior year and future data.  Don't want to pull all kinds of historical data.

When I tried to link the 'Opp Date' to a Date table the report did not work correctly.  The dates were blank and could not filter on them.  It screwed up the report bad.

I instead had to make a custom field through the designer that did the same condition on State.  This worked.

Oppo Date = IF(Opportunity[Opportunity State] = "Open",Opportunity[Estimated Close Date],Opportunity[Actual Close Date]) 

Just wondering what the technical reason for this is.  Assuming it might be the difference between an M query custom field and a Power BI designer custom field.  Just thought it was odd.

And if anyone has any suggestions for how to do this easier or more efficiently I am all ears.

Thank you

 

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

Probably a reason for it, but not enough information presented to tell you what might be going wrong.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

What kind of information do you need?

Hi @madkow,

You said "When I tried to link the 'Opp Date' to a Date table the report did not work correctly.  The dates were blank and could not filter on them.  It screwed up the report bad." How did you do that? How to link table in query editor, could you please share more details?

Thanks,
Angelia


Hi @v-huizhn-msft

 

I am sorry if I was unclear.  I did not link in the query editor.

After the column was created in M Query and changes were applied I went back to the designer and linked it through the Relationships window.

When I attempted to link it to my date table, the report did not function as expected.  I've used date tables previously but this was different.  No data was showing.

The workaround was to create the custom column from the designer instead of the query editor.  That worked when linking the opportunity table to the date table.

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors