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
Morten_DK
Helper I
Helper I

Accounts Receivables open or not

I want to know if receivables is open or not. 

 

I have been inspired a lot by: https://community.powerbi.com/t5/Desktop/Dynamic-Accounts-Receivable-Aging/td-p/304192 

but I have some additional columns I needed to account for. So I have written the formala as:

 

OpenAmount =
VAR SelectedDate =
IF ( HASONEVALUE ( 'Indicator'[Date] ); VALUES ( 'Indicator'[Date] ); BLANK () )
RETURN
IF (
max('Receivables'[Document_date]) <= SelectedDate
&& (min('Receivables'[Clearing_date]) > SelectedDate || min('Receivables'[Clearing_date]) = BLANK())
&& SelectedDate <> BLANK();
[Amount];
BLANK ()
)

 

That works - it doens't give me the total amount, and furthermore I need to rewrite it into an expression without variables as I have to push it to an analysis services instance that does not support that feature yet. 

 

I tried to rewrite it to:

Calculateopen =
CALCULATE (
[Amount];
FILTER (
VALUES ( Indicator[Date] );
MAX ( 'Receivables'[Document_date] ) <= 'Indicator'[Date]
&& MIN ( 'Receivables'[Clearing_date] ) > 'Indicator'[Date]
)
)

 

But that doesn't work at all. Indicator table is a data table, but it is not connected to other tables.

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Seems like you are trying to do something similar to my Open Tickets Quick Measure here:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364

 

That being said, what about this:

 

IF (
max('Receivables'[Document_date]) <= IF ( HASONEVALUE ( 'Indicator'[Date] ); VALUES ( 'Indicator'[Date] ); BLANK () )
&& (min('Receivables'[Clearing_date]) > IF ( HASONEVALUE ( 'Indicator'[Date] ); VALUES ( 'Indicator'[Date] ); BLANK () ) || min('Receivables'[Clearing_date]) = BLANK())
&& IF ( HASONEVALUE ( 'Indicator'[Date] ); VALUES ( 'Indicator'[Date] ); BLANK () ) <> BLANK();
[Amount];
BLANK ()
)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

Seems like you are trying to do something similar to my Open Tickets Quick Measure here:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364

 

That being said, what about this:

 

IF (
max('Receivables'[Document_date]) <= IF ( HASONEVALUE ( 'Indicator'[Date] ); VALUES ( 'Indicator'[Date] ); BLANK () )
&& (min('Receivables'[Clearing_date]) > IF ( HASONEVALUE ( 'Indicator'[Date] ); VALUES ( 'Indicator'[Date] ); BLANK () ) || min('Receivables'[Clearing_date]) = BLANK())
&& IF ( HASONEVALUE ( 'Indicator'[Date] ); VALUES ( 'Indicator'[Date] ); BLANK () ) <> BLANK();
[Amount];
BLANK ()
)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi Greg,

 

Thanks a lot - that works 🙂 It does however not return a grand total, do you have any ideas for that also?

 

 

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.