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

Calculate due date (switching from Qliksense)

Hi,

Switching form Qliksensen and trying some formulas in PowerbI.

 

Master table for accounts receivables is able to calculate due date based on the following options. If field month = 0 the due date will calcuated by increasing invocie date (this is in cusomer transaction table) with number of days from field DDAYS (file in customer master tabe. Else end of month form invoice date will be used.

 

My questions is how would be able to do below formula in PowerBI

Within Qliksense the following formula:

=//aging brackets
//defied aging period to group otustanding invocies
// will use due date formula and substract it from current date and categorize outcome

 
   If(round( NOW() - (IF([MONTH]=0,[INVDTE]+[DDAYS],MONTHEND([INVDTE],0)+MONTH)),-1) <= 0, 'A. Current',
   If(round( NOW() - (IF([MONTH]=0,[INVDTE]+[DDAYS],MONTHEND([INVDTE],0)+MONTH)),-1)<=30, 'B. Below 30',
   If(round( NOW() - (IF([MONTH]=0,[INVDTE]+[DDAYS],MONTHEND([INVDTE],0)+MONTH)),-1)<=45, 'C. 30-45',
     
   If(round( NOW() - (IF([MONTH]=0,[INVDTE]+[DDAYS],MONTHEND([INVDTE],0)+MONTH)),-1) <= 60, 'D. 46-60',
 
   If(round( NOW() - (IF([MONTH]=0,[INVDTE]+[DDAYS],MONTHEND([INVDTE],0)+MONTH)),-1) <= 90, 'E. 61-90',
  
   If(round( NOW() - (IF([MONTH]=0,[INVDTE]+[DDAYS],MONTHEND([INVDTE],0)+MONTH)),-1) <= 180, 'F. 91-180',
      'G. Large 180' ))))))
1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi @J_aua 

You could use this formula to create a column as below:

https://docs.microsoft.com/en-us/dax/eomonth-function-dax

IF (
    ROUND (
        NOW ()
            - (
                IF ( [MONTH] = 0, [INVDTE] + [DDAYS], EOMONTH( [INVDTE],0 ) + [MONTH] )
            ),
        -1
    ) <= 0,
    'A. Current',
    IF (
        ROUND (
            NOW ()
                - (
                    IF ( [MONTH] = 0, [INVDTE] + [DDAYS], EOMONTH( [INVDTE],0 ) + [MONTH] )
                ),
            -1
        ) <= 30,
        'B. Below 30',
        IF (
            ROUND (
                NOW ()
                    - (
                        IF ( [MONTH] = 0, [INVDTE] + [DDAYS], EOMONTH( [INVDTE],0 ) + [MONTH] )
                    ),
                -1
            ) <= 45,
            'C. 30-45',
            IF (
                ROUND (
                    NOW ()
                        - (
                            IF ( [MONTH] = 0, [INVDTE] + [DDAYS], EOMONTH( [INVDTE],0 ) + [MONTH] )
                        ),
                    -1
                ) <= 60,
                'D. 46-60',
                IF (
                    ROUND (
                        NOW ()
                            - (
                                IF ( [MONTH] = 0, [INVDTE] + [DDAYS], EOMONTH( [INVDTE],0 ) + [MONTH] )
                            ),
                        -1
                    ) <= 90,
                    'E. 61-90',
                    IF (
                        ROUND (
                            NOW ()
                                - (
                                    IF ( [MONTH] = 0, [INVDTE] + [DDAYS], EOMONTH( [INVDTE],0 ) + [MONTH] )
                                ),
                            -1
                        ) <= 180,
                        'F. 91-180',
                        'G. Large 180'
                    )
                )
            )
        )
    )
)

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi @J_aua 

You could use this formula to create a column as below:

https://docs.microsoft.com/en-us/dax/eomonth-function-dax

IF (
    ROUND (
        NOW ()
            - (
                IF ( [MONTH] = 0, [INVDTE] + [DDAYS], EOMONTH( [INVDTE],0 ) + [MONTH] )
            ),
        -1
    ) <= 0,
    'A. Current',
    IF (
        ROUND (
            NOW ()
                - (
                    IF ( [MONTH] = 0, [INVDTE] + [DDAYS], EOMONTH( [INVDTE],0 ) + [MONTH] )
                ),
            -1
        ) <= 30,
        'B. Below 30',
        IF (
            ROUND (
                NOW ()
                    - (
                        IF ( [MONTH] = 0, [INVDTE] + [DDAYS], EOMONTH( [INVDTE],0 ) + [MONTH] )
                    ),
                -1
            ) <= 45,
            'C. 30-45',
            IF (
                ROUND (
                    NOW ()
                        - (
                            IF ( [MONTH] = 0, [INVDTE] + [DDAYS], EOMONTH( [INVDTE],0 ) + [MONTH] )
                        ),
                    -1
                ) <= 60,
                'D. 46-60',
                IF (
                    ROUND (
                        NOW ()
                            - (
                                IF ( [MONTH] = 0, [INVDTE] + [DDAYS], EOMONTH( [INVDTE],0 ) + [MONTH] )
                            ),
                        -1
                    ) <= 90,
                    'E. 61-90',
                    IF (
                        ROUND (
                            NOW ()
                                - (
                                    IF ( [MONTH] = 0, [INVDTE] + [DDAYS], EOMONTH( [INVDTE],0 ) + [MONTH] )
                                ),
                            -1
                        ) <= 180,
                        'F. 91-180',
                        'G. Large 180'
                    )
                )
            )
        )
    )
)

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
holydragon
Frequent Visitor

Hello,

 

I'm no powerBI expert but I think I could help you based on what I've learned so far.  Here is a screenshot of what I've done for you:Capture.JPG

It's just a single column in a table.

 

Let me know if this helps!

 

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.