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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
saranp780
Helper III
Helper III

PO Report with (+-) condition

I have a suite of example data below. That  I got for the system.

 

Purch.Doc.ItemMatYrPstng Date    Quantity   Amount in LCCrcyD/C
10200000021201728.08.201715027,750.00USDS
10200000021201728.08.201715027,750.00USDH
10200000021201701.08.201715027,750.00USDS
10200000031201805.01.201820018,000USDS
10200000032201805.01.201830021,300USDS
10200000031201805.04.2018504,500USDH
 1020000003 1 201808.04.2018252,250USDS
Please Note SDebit     
 HCredit     

 

Now, What I want to do is make a cumulative report using Debit and Credit to calculate. 

 

Just so you know about this data.

Posting date means the day of PO makes that move.

D/C Means Debit/Credit in the system it uses S instead Debit and H instead debit.

And when H the amount will be decreased, if S the amount will be Increased.

 

From my example data, the result will be like this.

Year 2017             
Purch.Doc.JanFebMarAprMayJunJulAugSep OctNovDecTotal
1020000002       27,750.00    

27,750

(27,750-27,750+27,750)

              
Year 2018             
102000000339,300  4,5002,250       

37,050

(39,300-4,500+2,250)

 

Please help to tell me the DAX that I can use to solve my requirement.

 

Thank you all.

1 ACCEPTED SOLUTION
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @saranp780,

Please follow the steps below.

1. Create a calendar table clicking 'New Table' under Modeling on Home page, type the formula. Create a month column.



Calendar = CALENDAR(DATE(2017,1,1),DATE(2018,12,31))
Column = FORMAT('Calendar'[Date],"MMM")


2. Create a relationship between your fact table(1) and Calendar table(n).

1.GIF

3. Create a calculated column using the formula.

Amount_new = IF(Table2[D/C]="S",Table2[   Amount in LC],-Table2[   Amount in LC])

2.GIF

4. Create a matrix, select MatYr and Purch.Doc as rows level, the Month as column, then click the button highlighted in yellow, you will get the right result.

3.GIF
Best Regards,
Angelia

View solution in original post

1 REPLY 1
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @saranp780,

Please follow the steps below.

1. Create a calendar table clicking 'New Table' under Modeling on Home page, type the formula. Create a month column.



Calendar = CALENDAR(DATE(2017,1,1),DATE(2018,12,31))
Column = FORMAT('Calendar'[Date],"MMM")


2. Create a relationship between your fact table(1) and Calendar table(n).

1.GIF

3. Create a calculated column using the formula.

Amount_new = IF(Table2[D/C]="S",Table2[   Amount in LC],-Table2[   Amount in LC])

2.GIF

4. Create a matrix, select MatYr and Purch.Doc as rows level, the Month as column, then click the button highlighted in yellow, you will get the right result.

3.GIF
Best Regards,
Angelia

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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