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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
monish
Frequent Visitor

DAX query to create custom table

We had a dashboard in excel. One of the Summary view had values pulled from different source (Pivot table). Some fields were calculated using simple division etc. 

 

I'm trying to replicate the excel view in Power BI. In order to do that, I'm using DAX query to create some static values. The table has only 2 rows. Please see below for example. 

 

Excel

The below table contains sample data. 'Commitment Type' has static values - Funded and Unfunded. The values for Total Losses are being pulled from anoter pivot table using the formula  as shown below

Funded GETPIVOTDATA("Sum of funded_losses",'LL Pivots'!$A$7) 

Unfunded GETPIVOTDATA("Sum of unfunded_losses",'LL Pivots'!$A$7) 

 

Similarly Balance is pulled from two other columns in the pivot table. The last column 'Percent of total' is calculated using B2/C2 for Funded.

 

Excel table

A                           B                       C                    D

Commitment TypeTotal LossesBalancePercent of total
Funded$1,234,567$23,465,8635%
Unfunded$0$00%

 

DAX

Using DAX I'm trying to create some static values first as shown below.

 

CustomTable = DATATABLE( "Commitment Type", STRING, "Total Losses", INTEGER, "Balance", INTEGER,
{
{"Funded",      ,     },
{"Unfunded",      ,       }
})

But I'm finding it hard to pull the data for the other columns from a table something like to fill the above blank spaces in the query.  Also how do I calculate the in table division? 

SUMMARIZE (
            Table,
            Table[Sum of funded_losses]
)

SUMMARIZE (
Table,
Table[Sum of unfunded_losses]
)

 

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

I would create your datatable but with only a single column, then use ADDCOLUMNS to add your other columns and then you can tie these to just about any calculation.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi Greg,

 

I first created a table using DATATABLE and then tried to ADDCOLUMNS, But I'm unable to perform this operation with this below query. I'm using Summarize to group by a column[INDICATOR] in a table named 'OUT' and then get the SUM(CREDIT_LIMIT).

 

ADDCOLUMNS(CustomTable, "Total Losses", SUMMARIZE(OUT, OUT[INDICATOR],"Total",SUM(OUT[CREDIT_LIMIT])))

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.