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
tarekeal
New Member

Calculated column with one filter selected and no filter

Hi, I have a table with date, salepersons, their location and their sales amount and a status column saying if they are internal or external.

DateSalespersonsLocationAmountStatus
12/1/2022JeanBrussels125Internal
12/1/2022AlexBrussels150External
13/1/2022BrunoParis130Internal


In a calculated table using SUMMARIZECOLUMNS I'm summarizing the sales by location and date but I'm struggling with the status since I would like to differentiate between internal and ALL (which is basically the sum of both), not between internal and external, such as hereunder.

DateLocationStatusAmount
12/1/2022BrusselsInternal125
12/1/2022BrusselsAll275
13/1/2022ParisInternal130
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Picture1.png

 

NewTable = 
VAR tablefilter =
SELECTCOLUMNS(
    FILTER (
        ADDCOLUMNS (
            Data,
            "@filter", IF ( Data[Status] = "Internal", "Internal", "All" )
        ),
        [@filter] = "Internal"
    ), "Date",  Data[Date], "Location", Data[Location], "@Status", [@filter], "@Amount", Data[Amount] )
VAR summarytable =

    SUMMARIZECOLUMNS (
        Data[Date],
        Data[Location],
        "@Status", IF("External" in VALUES(Data[Status]),"ALL", BLANK()),
        "@Amount", IF("External" in VALUES(Data[Status]), SUM ( Data[Amount] ), BLANK() )
    )
RETURN
UNION( tablefilter,
 summarytable )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

4 REPLIES 4
wdx223_Daniel
Super User
Super User

wdx223_Daniel_0-1647840776592.png

 

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Picture1.png

 

NewTable = 
VAR tablefilter =
SELECTCOLUMNS(
    FILTER (
        ADDCOLUMNS (
            Data,
            "@filter", IF ( Data[Status] = "Internal", "Internal", "All" )
        ),
        [@filter] = "Internal"
    ), "Date",  Data[Date], "Location", Data[Location], "@Status", [@filter], "@Amount", Data[Amount] )
VAR summarytable =

    SUMMARIZECOLUMNS (
        Data[Date],
        Data[Location],
        "@Status", IF("External" in VALUES(Data[Status]),"ALL", BLANK()),
        "@Amount", IF("External" in VALUES(Data[Status]), SUM ( Data[Amount] ), BLANK() )
    )
RETURN
UNION( tablefilter,
 summarytable )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thanks a lot, I ended up using SUMMARIZECOLUMNS twice since the first table was not giving the right values with the real data.

amitchandak
Super User
Super User

@tarekeal why there is no all by pairs?

One way is

Union(

Summarize(Table, Table[Date], Table[Location], Table[Status], "Amount", Sum(Table[Amount]) ) ,

Summarize(Table, Table[Date], Table[Location], Status, "All", "Amount", Sum(Table[Amount]) )

)

 

or

 

Union(

Summarize(Table, Table[Date], Table[Location], Table[Status], "Amount", Sum(Table[Amount]), "_cnt", countrows(Table) ) ,

filter( Summarize(Table, Table[Date], Table[Location], Status, "All", "Amount", Sum(Table[Amount]), "_cnt", countrows(Table) ), "_cnt" >1)

)

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.