Forum Discussion

BHinote's avatar
BHinote
Frequent Visitor
6 years ago

FIRSTNONBLANK or Alternative to extract a single cell based on two filter criteria

Is there any way to do something similar to the following at the Power Query (i.e. M-Code) level?

 

Task_DteDwnCmp_Date = 
CALCULATE (
    FIRSTNONBLANK ( DW_TaskAddonDataView[Task_CompletedDate], 1 ),
    FILTER ( ALL ( DW_TaskAddonDataView ), 'DW_TaskAddonDataView'[Order_RootID] = 'SPSOrderProfile'[RootID] && LOWER('DW_TaskAddonDataView'[LookupCD]) = "dtedwncmp" ))

 

The Calculated Column above works as intended in DAX.  It retrieves a single cell value for the "First" Non-Blank record that matches the Two Filter Criteria.

I created a Custom Formula at the Power Query Level, which can only include Columns available in Power Query.  Because of this, I must find a way to create a Custom Column, at the same level, that contains the Date from a Second Table when the content in Two different columns match Two Columns from the Second Table.

 

Any positive assistance would be greatly appreciated.

(Here is an example)

Table: SPSOrderProfile

 

 

 

Table: DW_TaskAddonDataView

 

 

 

 

 

 

 

 

Result: (The Result is made up of a Unique Record from the SPSOrderProfile Table and the 1st Non-Blank "DteDwnCmp" record found in the DW_TaskAddonDataView table, filtered by SpsOrderProfile[RootId#] = DW_TaskAddonDataView[Order_RootId#] and DW_TaskAddonDataView[LookupCD] = "DteDwnCmp")

1 Reply

  • AlB's avatar
    AlB
    Icon for Community Champion rankCommunity Champion

    Hi BHinote 

    Can you please show two simple tables as example and the final result you would need from them? I am not sure I understad exactly  what you are after

    Please mark the question solved when done and consider giving kudos if posts are helpful.

     Cheers