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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
danextian
Super User
Super User

How to create a filtered calculated table with more than one column.

Hello,

 

I'd like to create a calculated table taken from the data below.

What I want  is to get the Case and Count column filtered based on the max value by case in count column.

I do know how to create a calculated table with filtered rows but not if it has more than one column. 

 

CasecountOther columnOther column2
Case11valuevalue
Case22valuevalue
Case33valuevalue
Case44valuevalue
Case55valuevalue
Case62valuevalue
Case73valuevalue
Case84valuevalue
Case91valuevalue
Case12valuevalue
Case23valuevalue
Case31valuevalue
Case41valuevalue
Case52valuevalue
Case64valuevalue
Case75valuevalue
Case86valuevalue
Case97valuevalue




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
4 REPLIES 4
sokg
Solution Supplier
Solution Supplier

Hi @danextian

 

Try this as a new table

 

Table = ADDCOLUMNS (
    SUMMARIZE ( Table1, Table1[Case] ),
    "MAXCOUNT", CALCULATE ( MAX ( Table1[count] ) )
)

 

I think it works.

Anonymous
Not applicable

Hi @danextian,

 

>>I do know how to create a calculated table with filtered rows but not if it has more than one column. 

You can try to use 'AND' or 'OR' function to add these conditions in one filter.

 

Sample:

//filter table when Column 1 = "111" and Column 2 =2

Result=
CALCULATETABLE('Table',FILTER(ALL('Table'),AND([Column1]="111",[Column2]=2)))

//filter table when Column 1 = "111" or Column 2 =2
Result=
CALCULATETABLE('Table',FILTER(ALL('Table'),OR([Column1]="111",[Column2]=2)))


Another write method :

Result=
CALCULATETABLE('Table',FILTER(ALL('Table'),[Column1]="111"&&[Column2]=2))

Result=
CALCULATETABLE('Table',FILTER(ALL('Table'),[Column1]="111"||[Column2]=2))

 

 

Regards,

Xiaoxin Sheng

Hi @Anonymous

 

Thanks  for the reply.

 

What I was trying to say was I would like to return just  two columns from the original table to a calculated one - Case and Count columns.  The  criteria is max value in Count  column  based on distinct values in Case column.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hey,

 

Assuming you want to solve this with DAX:

 

If you are on Power BI or SSAS 2016 you can go with GROUPBY otherwise you can try SUMMARIZE (be aware that SUMMARIZE has its issues)

 

The GROUPBY can look like this

GROUPBY('BaseTable',BaseTable[Case],"Count", MAXX(CURRENTGROUP(),'BaseTable'[Count])) 

Hope this helps



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.