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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
GeoffHill
Frequent Visitor

DAX to M language

Hi,

I'm trying to convert the below calculated column in DAX to Power Query M language so the Calculated column can refresh with the scheduled refresh.

DAX for Calculated column is:

WS Name = CALCULATE(FIRSTNONBLANK('(Discount) Supplier Outlet'[Primary Wholesaler Name],1),FILTER(ALL( '(Discount) Supplier Outlet'),'(Discount) Supplier Outlet'[Outlet__c]='(Discount) Outlet Contract WS Number'[Outlet__c]))

 

Looking for the equivalent M language to generate an additioncal column in the table.

 

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @GeoffHill ,

Since the equiment dax formula in this case is min(), you can try this query:

MIN ( <column> ) = FIRSTNONBLANK ( <column>, 1 )

let
    Source = Table.NestedJoin(#"(Discount) Outlet Contract WS Number", {"Outlet__c"}, #"(Discount) Supplier Outlet", {"Outlet__c"}, "(Discount) Supplier Outlet", JoinKind.LeftOuter),
    #"Added Custom" = Table.AddColumn(Source, "Result", each List.Min([#"(Discount) Supplier Outlet"][Primary Wholesaler Name]),type text),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"(Discount) Supplier Outlet"})
in
    #"Removed Columns"

vyingjl_0-1629947057293.png

vyingjl_1-1629947091408.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-yingjl
Community Support
Community Support

Hi @GeoffHill ,

Since the equiment dax formula in this case is min(), you can try this query:

MIN ( <column> ) = FIRSTNONBLANK ( <column>, 1 )

let
    Source = Table.NestedJoin(#"(Discount) Outlet Contract WS Number", {"Outlet__c"}, #"(Discount) Supplier Outlet", {"Outlet__c"}, "(Discount) Supplier Outlet", JoinKind.LeftOuter),
    #"Added Custom" = Table.AddColumn(Source, "Result", each List.Min([#"(Discount) Supplier Outlet"][Primary Wholesaler Name]),type text),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"(Discount) Supplier Outlet"})
in
    #"Removed Columns"

vyingjl_0-1629947057293.png

vyingjl_1-1629947091408.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

wdx223_Daniel
Community Champion
Community Champion

Table.AddColumn(#"(Discount) Outlet Contract WS Number","WS Name",each List.Skip(Table.SelectRows(#"(Discount) Supplier Outlet",(x)=>x[Outlet__c]=[Outlet__c])[Primary Wholesaler Name],each _=null or _=""){0}?)

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.