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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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