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
shanipowerbi
Helper III
Helper III

Need Point in Time Last Invoice Amount

Hi Experts

 

I need your urgent help, I have two tables 1 - Active Users (Servers) 2 - Invoice Data

Active Users (Servers)
DateUser ID
Feb-20126389
Feb-20126611
Mar-20126389
Mar-20126611
Apr-20126389
Apr-20126611
May-20126389
May-20126611
Jun-20126389
Jun-20126611
Jul-20126389
Jul-20126611
Aug-20126389
Aug-20126611
Sep-20126389
Sep-20126611

 

Invoice Data
DateUser IDInvoice Amount
Jan-20126389 $  10
Feb-20126389 $ 15
Feb-20126611 $ 10
Mar-20126389 $ 20
Mar-20126611 $ 20
Apr-20126389 $ 25
Apr-20126611 $ 30
May-20126389 $ 30
May-20126611 $ 40
Jun-20126389 $ 35
Jun-20126611 $ 50
Jul-20126389 $ 40
Jul-20126611 $ 60
Aug-20126389 $ 45
Aug-20126611 $ 70
Sep-20126389 $ 50
Sep-20126611 $ 80

 

Both tables are separate the result I need the amount in a 

 

Event Date
DateUser IDPoint of Time Invoice Last Invoice
Feb-20126389 $10.00
Feb-20126611 $0  
Mar-20126389 $15.00
Mar-20126611 $10.00
Apr-20126389 $ 20.00
Apr-20126611 $20.00
May-20126389 $25.00
May-20126611 $30.00
Jun-20126389 $30.00
Jun-20126611 $40.00
Jul-20126389 $35.00
Jul-20126611 $50.00
Aug-20126389 $40.00
Aug-20126611 $60.00
Sep-20126389 $45.00
Sep-20126611 $70.00

 

1 ACCEPTED SOLUTION

Step 1---Create a bridge table with unique user id

vpanchu_0-1601677398024.png

 

 

Step 2 --Create a calculated colum in the Active user table 

Pending Invoice last month =
     LOOKUPVALUE('Invoice data'[Invoice Amount],
         'Invoice data'[Date],DATEADD('Active User'[Date],-1,MONTH)
)
 
 
Step3----pull the highlighted fields in a table
 
 
Capture.JPG

 
 

 Note: it is not showing  the Feb value for user 126389 because there is no data in the active user table , you can work on the source , but hope you got the context.

 

Rergards

Vpanchu 

 

 
 

View solution in original post

9 REPLIES 9
mhossain
Solution Sage
Solution Sage

@shanipowerbi 

 

Create a calculated column in your "Active user" table as below:

 

Point of Time Invoice Last Invoice=

LOOKUPVALUE(Invoice_Data[Invoice Amount],Invoice_Data[Date],DATEADD(Active_Users[Date],-1,MONTH))

 

Make sure you have created relationship between the tables on the userID.

 

Please let me know if this solves.

Thanks for the help, how can I make the relationship as you can see both tables have multiple User IDs of the same User.

 

@shanipowerbi 

It should work with many to many relationship as well , as @mhossain  said.

Step 1---Create a bridge table with unique user id

vpanchu_0-1601677398024.png

 

 

Step 2 --Create a calculated colum in the Active user table 

Pending Invoice last month =
     LOOKUPVALUE('Invoice data'[Invoice Amount],
         'Invoice data'[Date],DATEADD('Active User'[Date],-1,MONTH)
)
 
 
Step3----pull the highlighted fields in a table
 
 
Capture.JPG

 
 

 Note: it is not showing  the Feb value for user 126389 because there is no data in the active user table , you can work on the source , but hope you got the context.

 

Rergards

Vpanchu 

 

 
 

Hi @vpanchu 

 

Thanks It's working but the problem I am facing is it's taking too much time for calculation. I have data from 2018 and each day I get around 24K rows in Active data and increasing with business. Is that any optimize way to get this data?

 

Regards

 

Shan

@shanipowerbi

1- you can try incremental load if you have pro account. (i am not sure What is your subscription)

2- you can Try giving one to many relationship insted of many to many.

3- Try to avoide columns with high cardinality if you dont really require it.

4- Use measures wherever required instead of calculated column.

Regards

Vpanchu

Mark the answer if its working for you, it may help other.

Please give Kudos if it was informative in any way 🙂

Hi @vpanchu

We are using Pro Account

Hi @shanipowerbi

Have you tried incremental Refresh , instead of loading all the data every time?

because 24 k rows can be handled by PowerBI very easily its nothing.

https://docs.microsoft.com/en-us/power-bi/admin/service-premium-incremental-refresh#:~:text=Incremen....

Regards

Vinayak

@shanipowerbi 

 

You can create many to many relationship, do you see any challenges?

 

mhossain_0-1601676346969.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.