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 All,
I have attached pbix file:
https://www.dropbox.com/s/g9el2fm4o637gl2/Open%20%26%20Closeing%20Balance.pbix?dl=0
I have data like below table. By using this table i want to create "Opening & Closing Balance". Expected output was shown in below screenshot
scenario 1 : If I did not select any Date value from Date Filter, Then the Output is
scenario 2 : If Date filter is from 02/27/2020 to 03/31/20202 Then Output is:
Note: Opening Balance for Product sales is sum(opening Balance) where Date is 02/27/2020. Because Product Sales Min Date is 02/27/2020 so -175584.24+0 = -175584.24
Solved! Go to Solution.
I have no working file 🙂
Give this a try, if I'm thinking about this correctly this should return the totals you're looking for:
Opening Balance =
VAR P_date = IF(SELECTEDVALUE(Table[Posting Date]) = BLANK() , MIN(Table[Posting Date]) , SELECTEDVALUE(Table[Posting Date]))
Return
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] < P_Date)
Closing Balance =
VAR P_date = IF(SELECTEDVALUE(Table[Posting Date]) = BLANK() , MAX(Table[Posting Date]) , SELECTEDVALUE(Table[Posting Date]))
Return
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] <= P_Date)
Let me know how it goes!
/ J
There are a few different ways and it working depends on the structure of the matrix. But lets try the easiest first, adding a "+0".
Opening Balance =
VAR P_date = IF(SELECTEDVALUE(Table[Posting Date]) = BLANK() , MIN(Table[Posting Date]) , SELECTEDVALUE(Table[Posting Date]))
Return
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] < P_Date) + 0
Let me know if it works.
/ J
Try this,
Opening Balance =
VAR P_date = SELECTEDVALUE(Table[Posting Date])
Return
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] < P_Date)
Closing Balance =
VAR P_date = SELECTEDVALUE(Table[Posting Date])
Return
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] <= P_Date)
Let me know how it goes.
/ J
@tex628 , Thanks for response,
Every things looks good.. Except total value..
i have created Master Calendar & connected with Posting Date. Added calendar date in filter & table.
Can you Please share the working File.
I have no working file 🙂
Give this a try, if I'm thinking about this correctly this should return the totals you're looking for:
Opening Balance =
VAR P_date = IF(SELECTEDVALUE(Table[Posting Date]) = BLANK() , MIN(Table[Posting Date]) , SELECTEDVALUE(Table[Posting Date]))
Return
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] < P_Date)
Closing Balance =
VAR P_date = IF(SELECTEDVALUE(Table[Posting Date]) = BLANK() , MAX(Table[Posting Date]) , SELECTEDVALUE(Table[Posting Date]))
Return
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] <= P_Date)
Let me know how it goes!
/ J
Thank you @tex628 .. Its Working...
I got what i want. thank you so much
one more request.. how can i replace blank value by Zero
There are a few different ways and it working depends on the structure of the matrix. But lets try the easiest first, adding a "+0".
Opening Balance =
VAR P_date = IF(SELECTEDVALUE(Table[Posting Date]) = BLANK() , MIN(Table[Posting Date]) , SELECTEDVALUE(Table[Posting Date]))
Return
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] < P_Date) + 0
Let me know if it works.
/ J
@Anonymous , not very clear. is the balance of A going to C.
Can you share sample data and sample output in table format?
refer :closingbalancemonth ,closingbalancequarter, closingbalanceyear
https://www.youtube.com/watch?v=yPQ9UV37LOU
firstnonblankvalue and lastnonblankvalue
https://www.linkedin.com/pulse/five-recent-power-bi-functions-you-should-use-more-often-amit-chandak
@amitchandak , Thanks for the reply
if i select Date range from 02/27/2020 Then
Sales-A opening balance for 02/27/2020 is -175583.24.... 03/03/2020 opening balance is -175583.24 + (-5950.00) =-181534.24 etc...
Sales-B opening balance for 02/27/2020 is 0
Sales-C opening balance for 03/09/2020 is 0
Sales-D opening balance for 03/24/2020 is 0..... 03/30/2020 opening balance is -62874
Sales-A, Sales-B, Sales-C, Sales-D are catergrozied under Product Sales... so Product Sales Minimum Date is 02/27/2020..
Product Sales opening balance is sum of opening balance where Date is 02/27/2020
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 |
---|---|
112 | |
99 | |
73 | |
72 | |
49 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |