Forum Discussion

Ormy28's avatar
Ormy28
Regular Visitor
1 year ago
Solved

Add New Columns to Summary Table

Hi

 

I'm quite new to DAX, so there might be a straightforward solution to this.

 

I have a table of data as below, with dates and a colour.

IDWeek StartColour
107/04/2025Red
207/04/2025Red
307/04/2025Red
407/04/2025Blue
507/04/2025Green
614/04/2025Red
714/04/2025Red
814/04/2025Blue
914/04/2025Blue

 

I have created a summary table SUMMARIZE that would return the below:

Week StartREDBLUEGREEN
07/04/2025311
14/04/2025220

 

This is how I did this:

SUMMARIZE('Table1', 'Table1'[Start of Week],

"RED", CALCULATE(COUNT('Table1'[Colour]), FILTER('Table1', [Colour] = "Red")),

"BLUE", CALCULATE(COUNT('Table1'[Colour]), FILTER('Table1', [Colour] = "Blue")),

"GREEN", CALCULATE(COUNT('Table1'[Colour]), FILTER('Table1', [Colour] = "Green"))

)

 

However, a new colour could appear in the future. Therefore, if Yellow was to appear in week starting 21/04/2025, I would need to amend the above DAX to pick up this new colour.

 

Is there any way to create a summary table that would list all colours for a particular date, along with the associated count, without having to amend the DAX when they appear? I might be heading down the wrong avenue using SUMMARIZE and there is a more efficient way of doing this. Any help would be greatly apreciated.

 

Thanks.

 

 

  • Hi Ormy28 

    Plase use below DAX 

    DynamicSummary =
    SUMMARIZE(
        'Table', 
        'Table'[Week Start], 
        'Table'[Colour],
        "Count", COUNT('Table'[ID])
    )

     

     

2 Replies

  • PijushRoy's avatar
    PijushRoy
    Community Champion

    Hi Ormy28 

    Plase use below DAX 

    DynamicSummary =
    SUMMARIZE(
        'Table', 
        'Table'[Week Start], 
        'Table'[Colour],
        "Count", COUNT('Table'[ID])
    )

     

     

    • Ormy28's avatar
      Ormy28
      Regular Visitor

      Excellent, thanks for the help. A straightforward and logical solution.