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
PD_FKL
New Member

Distribute Value to ratio and date offset

Hello together,

 

I have a table1 containing Value and DueDate.

Additionally I have a table2 which gives me some offsets and ratios e.g.

OffsetDaysRatio
060%
2020%
4020%

 

So I would like to distribute my value to 60% on the due date 20% 20 days after the due date and another 20% 40 days after the due date.

 

Since I am not using Power BI but Excel I can't create a calculated table and since I want to apply this logic to multiple tables it would be great if this could be solved with a DAX measure instead of merging and expanding in M.

I hope someone has a suitable solution.

Best regards

Florian

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

That turned out to be surprisingly simple.

 

lbendlin_0-1707964138055.png

 

View solution in original post

3 REPLIES 3
PD_FKL
New Member

Thanks for pointing me in the right direction.

I had to convert it to a Crossjoin since Excel was giving me a context error, in Power BI it works smoothly.

Phasing2:=VAR a = 
//https://dax.guide/summarizecolumns/
Filter(
	ADDCOLUMNS(
		CROSSJOIN(
			VALUES( Calendar[Date] );
			Dates; 
			Facts
		);
		"Amount"; If( [Date] = [DueDate] + [Offset]; [Value] * [Ratio] )
	);
	NOT( ISBLANK( [Amount] ) )
)
//SUMMARIZECOLUMNS( Calendar[Date];Facts[DueDate];Facts[Value];Dates[Offset];Dates[Ratio])
//VAR b= ADDCOLUMNS( a; "amt"; IF(Calendar[Date] = Facts[DueDate] + [Offset]; [Value] * [Ratio]))
RETURN
SUMX( a; [Amount])

Yes, my use of SUMMARIZECOLUMNS was a bit, uhm, lazy.  Could have done a cross join from the get-go. Same idea.

lbendlin
Super User
Super User

That turned out to be surprisingly simple.

 

lbendlin_0-1707964138055.png

 

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