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
CJKPowerBI
Helper I
Helper I

table per section Actual with total and then Ad-hoc and Budgeted with totals as well as sum

hello all,

 

i have my data in excel like below

 

Actual / Budgeted / Ad-hocTranscation DateAmountWhoDescription
Actual9/23/2018$1,000.00CJKItem 1
Actual9/26/2018$200.00CJKItem 2
Budgeted9/26/2018$130.00CJKItem 3
Budgeted9/26/2018$26.00CJKItem 4
Ad-hoc9/26/2018$130.00CJKItem 5
Ad-hoc9/26/2018$26.00CJKItem 6

 

and i would like a formula to give me the below results...

Screenshot 2022-10-10 162841.png

 

and Grand Total for 26 : ($200+(-$312) = -$112

 

let me know pls.

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @CJKPowerBI ,

According to your description, I create a sample.

vkalyjmsft_0-1665457480620.png

Here's my solution. Create two calculated columns.

Actual/Ad-hoc Budgeted =
IF ( [Actual / Budgeted / Ad-hoc] = "Actual", "Actual", "Ad-hoc Budgeted" )
Column =
IF (
    'Table'[Actual/Ad-hoc Budgeted] = "Actual",
    'Table'[Amount],
    'Table'[Amount] * -1
)

vkalyjmsft_1-1665457703764.png

Then put the columns in a matrix like below, get the correct result.

vkalyjmsft_2-1665457761376.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yanjiang-msft
Community Support
Community Support

Hi @CJKPowerBI ,

According to your description, I create a sample.

vkalyjmsft_0-1665457480620.png

Here's my solution. Create two calculated columns.

Actual/Ad-hoc Budgeted =
IF ( [Actual / Budgeted / Ad-hoc] = "Actual", "Actual", "Ad-hoc Budgeted" )
Column =
IF (
    'Table'[Actual/Ad-hoc Budgeted] = "Actual",
    'Table'[Amount],
    'Table'[Amount] * -1
)

vkalyjmsft_1-1665457703764.png

Then put the columns in a matrix like below, get the correct result.

vkalyjmsft_2-1665457761376.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

thank you that worked great

Shaurya
Memorable Member
Memorable Member

Hi @CJKPowerBI,

 

Create a Type column that treats Ad-hoc and Budgeted as the same field and Actual as another. Then use the following formula to get the total:

 

Total = IF(MAX('Table'[Type])="Ad-hoc Budgeted", CALCULATE(SUM('Table'[Amount]))*-1, CALCULATE(SUM('Table'[Amount])))

 

Result:

 

Screenshot 2022-10-11 035651.jpg

 

As far as the grand total is concerned, you can refer to this post:

 

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

 

Works for you? Mark this post as a solution if it does!

 

hello @Shaurya  and thank you for your reply,

 

couple of questions:

1) i have a column named "Actual / Budgeted/ Ad-hoc" as shown at my initial request but i dont understand what you mean by "Create a Type column that treats Ad-hoc and Budgeted as the same field and Actual as another"? can you pls explain a bit more.

 

2) the formula is a measure or a column

3) the table which you show is a "slicer" a "table" or a "matrix"?

 

let me know pls.

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.