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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.