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 August 31st. Request your voucher.

Reply
joshua1990
Post Prodigy
Post Prodigy

Create table based on DAX

Hi community!

I have a data with 1 dimensional table and different transaction tables.

  • Dim 1 : Country, Department, Team, Product 
  • Calendar table
  • 1. Transaction Table: Sales
  • 2. Transaction Table: Revenue
  • 3. Transaction Table: Costs

The tables are linked by Product and Date.

Now I would like to create a calculated table that contains this format:

CountryAreaTeamKPILevelValue
FranceAAA1SalesGood5
FranceAAA1SalesNeutral6
FranceAAA1SalesBad8
FranceAAA1CostsGood8
FranceAAA1CostsNeutral6
FranceAAA1CostsBad5

 

As you can see we have 3 columns with the dimensions Country, Area and Team.

Then we have the specific KPI (Sales, Costs, Revenue) with a specific "Level" and value.

The value shows the frequence/ bumber of weeks we have been able to reach a specific goal:

Sales

  • Good: Sales above 500
  • Neutral: Sales 200-500
  • Bad: Sales below 200

 

How is this possible with dax?

I don't need this information as a matrix, that would be easy.

I need this as a calculated table.

 

I am grateful for every help!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @joshua1990 ,

I created some data:

For example:

Transaction Table: Costs

vyangliumsft_0-1654591923589.png

When the three table structures of Transaction Table: Sales Transaction Table: Revenue Transaction Table: Costs are the same, we can use the Append method.

Here are the steps you can follow:

1. Go to Power query and select Append Queries -- Append Queries as New.

Enter the Append interface, select "Three or more tables", add three tables.

vyangliumsft_1-1654591923594.png

Result:

vyangliumsft_2-1654591923596.png

2. Select the created new table Append1, select [Sales],[Revenue],[Costs] – Unpivot Columns.

vyangliumsft_3-1654591923598.png

3. Select the two columns in the new data and change the names to "KPI", "Amount”.

vyangliumsft_4-1654591923599.png

4. Create calculated column.

Level =
SWITCH(
    TRUE(),
    'Append1'[Amount]<=200,"Bad",
    'Append1'[Amount]>200 &&'Append1'[Amount]<=500,"Neutral",
    'Append1'[Amount]>500,"Good")
Value =
COUNTX(FILTER(ALL('Append1'),'Append1'[KPI]=EARLIER('Append1'[KPI])&&'Append1'[Level]=EARLIER('Append1'[Level])),[Level])

vyangliumsft_5-1654591923600.png

5. Create calculated table.

Table =
SUMMARIZE('Append1',
'Append1'[Country],'Append1'[Area],'Append1'[Team],'Append1'[KPI],'Append1'[Level],'Append1'[Value])

6. Result:

vyangliumsft_6-1654591923602.png

 

Best Regards,

Liu Yang

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

2 REPLIES 2
Anonymous
Not applicable

Hi  @joshua1990 ,

I created some data:

For example:

Transaction Table: Costs

vyangliumsft_0-1654591923589.png

When the three table structures of Transaction Table: Sales Transaction Table: Revenue Transaction Table: Costs are the same, we can use the Append method.

Here are the steps you can follow:

1. Go to Power query and select Append Queries -- Append Queries as New.

Enter the Append interface, select "Three or more tables", add three tables.

vyangliumsft_1-1654591923594.png

Result:

vyangliumsft_2-1654591923596.png

2. Select the created new table Append1, select [Sales],[Revenue],[Costs] – Unpivot Columns.

vyangliumsft_3-1654591923598.png

3. Select the two columns in the new data and change the names to "KPI", "Amount”.

vyangliumsft_4-1654591923599.png

4. Create calculated column.

Level =
SWITCH(
    TRUE(),
    'Append1'[Amount]<=200,"Bad",
    'Append1'[Amount]>200 &&'Append1'[Amount]<=500,"Neutral",
    'Append1'[Amount]>500,"Good")
Value =
COUNTX(FILTER(ALL('Append1'),'Append1'[KPI]=EARLIER('Append1'[KPI])&&'Append1'[Level]=EARLIER('Append1'[Level])),[Level])

vyangliumsft_5-1654591923600.png

5. Create calculated table.

Table =
SUMMARIZE('Append1',
'Append1'[Country],'Append1'[Area],'Append1'[Team],'Append1'[KPI],'Append1'[Level],'Append1'[Value])

6. Result:

vyangliumsft_6-1654591923602.png

 

Best Regards,

Liu Yang

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

tamerj1
Super User
Super User

@joshua1990 

Can you provide some sample data to work with?

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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