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
JenniferWallace
Frequent Visitor

Need help with DAX

I want to create table like this.  How will we be able to achieve this using DAX? 

@Dangar332 

NamedollarWeeksdollars/week
Holiday Weeks$5512.34
Non-Holiday Weeks$4.9512.34
4 REPLIES 4
Dangar332
Super User
Super User

Hi, @JenniferWallace 

you want it from manual data entry or based on another table?

 

if it based on manual entry then try @FreemanZ  solution 



if based on another table then try below

 

newtable =
   addcolumn(
       all(tablename[holidayweekcolumn]),
       "dollar" ,calculate(sum(tablename[dollarcolumn])),
       "weeks",weeknum(tablename[datecolumn],2),
       "dollar/week",calculate(sum(tablename[dollar/weekcolumn]))   
   )

 

 

 

 

if it not work then ellaborate your problem

AnalyticPulse
Super User
Super User

can you tell us what kind of column and table you have in your data

 

FreemanZ
Super User
Super User

hi @JenniferWallace ,

 

do you mean a calculated table like:

table = 
DATATABLE (
    "Name",STRING,
    "dollar", CURRENCY,
    "Weeks", INTEGER,
    "dollars/week", DOUBLE,
    {
        { "Holiday Weeks", 5, 5, 12.34},
        { "Non-Holiday Weeks", 4.9, 5, 12.34}
    }
)

 

it worked like:

FreemanZ_0-1700464373883.png

 

123abc
Community Champion
Community Champion

To create a table like the one you've described using DAX (Data Analysis Expressions), you can use DAX measures in Power BI or other similar tools. Assuming you have a table in your data model that contains information about different types of weeks (e.g., "Holiday Weeks" and "Non-Holiday Weeks"), you can follow these steps:

  1. Create a New Table: Create a new table in Power BI or your data modeling tool where you can define the structure of your table. You can use the following DAX formula to create a new table:

SummaryTable = VALUES('YourWeeksTable'[WeekType])

 

  1. Replace 'YourWeeksTable' with the actual name of your table containing information about different weeks.

  2. Define DAX Measures: Define the following DAX measures to calculate the desired values:

TotalDollars = SUM('YourWeeksTable'[Dollar])

TotalWeeks = SUM('YourWeeksTable'[Weeks])

DollarsPerWeek = DIVIDE([TotalDollars], [TotalWeeks], 0)

 

To create a table like the one you've described using DAX (Data Analysis Expressions), you can use DAX measures in Power BI or other similar tools. Assuming you have a table in your data model that contains information about different types of weeks (e.g., "Holiday Weeks" and "Non-Holiday Weeks"), you can follow these steps:

  1. Create a New Table: Create a new table in Power BI or your data modeling tool where you can define the structure of your table. You can use the following DAX formula to create a new table:

    daxCopy code
    SummaryTable = VALUES('YourWeeksTable'[WeekType])

    Replace 'YourWeeksTable' with the actual name of your table containing information about different weeks.

  2. Define DAX Measures: Define the following DAX measures to calculate the desired values:

    daxCopy code
    TotalDollars = SUM('YourWeeksTable'[Dollar]) TotalWeeks = SUM('YourWeeksTable'[Weeks]) DollarsPerWeek = DIVIDE([TotalDollars], [TotalWeeks], 0)

    Adjust the column and table names based on your actual data model.

  3. Build the Table: Now, you can use these measures in your new table. Assuming you have a column named WeekType in your SummaryTable, add the following columns:

Name = 'SummaryTable'[WeekType]

Dollar = CALCULATE([TotalDollars], FILTER('YourWeeksTable', 'YourWeeksTable'[WeekType] = 'SummaryTable'[WeekType]))

Weeks = CALCULATE([TotalWeeks], FILTER('YourWeeksTable', 'YourWeeksTable'[WeekType] = 'SummaryTable'[WeekType]))

DollarsPerWeek = CALCULATE([DollarsPerWeek], FILTER('YourWeeksTable', 'YourWeeksTable'[WeekType] = 'SummaryTable'[WeekType]))

 

  1. These columns will retrieve the necessary values for each week type.

Remember to replace 'YourWeeksTable' with the actual name of your table containing the week information.

This way, you will have a table with the desired structure, showing the total dollars, total weeks, and dollars per week for each week type.

 

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

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

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.