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.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
89 | |
68 | |
61 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |