Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Summarize and MAX not functioning as expected

Hi, 

 

I have a table that looks like this

 

IDDateGenderSub-District

11/8/2019MA
22/8/2019MA
33/8/2019MB
43/8/2019FB
53/8/2019FB
610/8/2019FC
710/8/2019MC
821/8/2019FD
921/8/2019MD
1025/8/2019MD

 

I've ran the following table DAX query and got the following result: 

 

Table 6 = SUMMARIZE('table','table'[Sub-District],"Start_Date",MIN('table'[Date]),"End_Date",MAX('Table 2'[Date]),"Male",CALCULATE(count('table'[Gender]),'table'[Gender]="M"),"Female",CALCULATE(count('table'[Gender]),'table'[Gender]="F"))

 

Sub-DistrictEnd_DateMaleFemaleStart_Date

Sub-DistrictStart_DateEnd_DateMaleFemale
A1/8/2019 0:0025/8/2019 0:002 
B3/8/2019 0:0025/8/2019 0:0012
C10/8/2019 0:0025/8/2019 0:0011
D21/8/2019 0:0025/8/2019 0:0021

 

As you can note the MAX date column is not returning the right result as it basically maxed the date across the entire column. 

 

Any help would be appreciated.

 

Best,

Dat_Data

  • Hi Anonymous 

    For End_Date you are using Table 2 instead of  table:

    "End_Date"MAX ( 'Table 2'[Date] )

    When you SUMMARIZE over ' table',  you have no filters applied on Table 2, unless there's a relationship

2 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi Anonymous 

    For End_Date you are using Table 2 instead of  table:

    "End_Date"MAX ( 'Table 2'[Date] )

    When you SUMMARIZE over ' table',  you have no filters applied on Table 2, unless there's a relationship

    • Anonymous's avatar
      Anonymous
      Not applicable

      Wow..feeling a bit werid now... - completely missed this! thanks AlB