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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
safifaruqi
Helper I
Helper I

Need help with VAR based DAX

Hi Guys, 

I have the following data from a table called "Module Sales" with the following columns: Transaction Type, Document Number, Baseref where row level data could look like
Transaction Type = Invoice, Document Number = 244485, Baseref = 523620
Transaction Type = Delivery note, Document Number = 523620, Baseref = 140064
Transaction Type = Sales Order, Document Number = 140064, Baseref = 250926
Transaction Type = Quote, Document Number = 250926, Baseref = null how can i use the baseref associated with one transaction

The first document number in our case is generated at the time for furnishing a quote when the said baseref is null...as document converts from a quote to a sales order transaction type, previous document number is the breadcrumb that falls under baseref for the currend document number.

I want to create a calculated column that cycles through the selected document number with transaction type "invoice" to retrieve the cusomter delivery date recorded at the time of "sales order" we want to measure our own on-time delivery against the promised delivery date. 

safifaruqi_2-1676050917981.png

 

 

safifaruqi_0-1676050574904.png

safifaruqi_1-1676050883680.png

safifaruqi_3-1676051027657.png

 

my current dax 

calculated baseref =

VAR SelectedInvoice = SELECTEDVALUE('Module Sales'[document number])
VAR CurrentRow = CALCULATE(FIRSTNONBLANK('Module Sales'[baseref], 1),
FILTER('Module Sales',
'Module Sales'[Document Number] = SelectedInvoice))

Return CurrentRow

doesnt let me build on the above and just blanks out when I try to use the "current Row" variable output as a filter to find the "document number" where the "transaction type" is "delivery note" and "document number" = "current row" output. 

 

Any help would be greatly appreciated ! 

Thanks guys. 



 

0 REPLIES 0

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors