Forum Discussion

Morten_DK's avatar
Morten_DK
Icon for Helper I rankHelper I
8 years ago
Solved

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.

  • 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 ()
    )

2 Replies

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

    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 ()
    )
    • Morten_DK's avatar
      Morten_DK
      Icon for Helper I rankHelper I

      Hi Greg,

       

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