Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi Experts
I need your help to calculate second last invoice amount. I have two table that contain
1 - Invoive Data
Invoice ID / User ID / Invoice Amount / Invoice Date
2 - User Profiling Data
User ID / Channel / Conversion Date / Signup Date
I have made relationship and calcualte the last invoice amount by using
Last Invoice Amount = Calculate (Sumx(Invoice Amount),LastDate(Invoice Date)
this formula gave me the last invoice amount of each user in User Profiling Data, now I am stuck in Second last invoice amount and I need it badly to calculate some very important analysis. Please look into this
Solved! Go to Solution.
I believe you are trying to create a column.
This should work.
2ND Last Invoice Amount = VAR LAST_DATE = LASTDATE ( Invoice[Invoice Date] ) VAR PREVIOUS_DATE = CALCULATE ( MAX ( Invoice[Invoice Date] ), FILTER ( ALL ( Invoice[Invoice Date] ), Invoice[Invoice Date] < LAST_DATE ) ) RETURN CALCULATE ( SUM ( Invoice[Invoice Amt] ), Invoice[Invoice Date] = PREVIOUS_DATE ) |
If it helps mark it as a solution.
Kudos are nice too
is the invoice date different for different users?
try the below post which is similar situation
Are you trying to create a new column in User_Profile table or is it gonna be a measure?
What is the relationship type between the tables?
How about sharing sample dataset?
Yes trying to get new column, about relationship i have created relationship b/w User IDs
I believe you are trying to create a column.
This should work.
2ND Last Invoice Amount = VAR LAST_DATE = LASTDATE ( Invoice[Invoice Date] ) VAR PREVIOUS_DATE = CALCULATE ( MAX ( Invoice[Invoice Date] ), FILTER ( ALL ( Invoice[Invoice Date] ), Invoice[Invoice Date] < LAST_DATE ) ) RETURN CALCULATE ( SUM ( Invoice[Invoice Amt] ), Invoice[Invoice Date] = PREVIOUS_DATE ) |
If it helps mark it as a solution.
Kudos are nice too
User | Count |
---|---|
106 | |
89 | |
81 | |
76 | |
73 |
User | Count |
---|---|
112 | |
104 | |
96 | |
74 | |
66 |