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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
avalos
Frequent Visitor

Display a number in a column, but do not sum it

I was wondering if there is any way to have a SUM column, but limit wich values are added.

This would be a simplified example of what I want to achieve: 

Original data

UnitBranchDate
XYZ1Branch 22019/6/1
XYZ2Headquarters2019/6/2
XYZ3Branch 12019/6/3
XYZ4Branch 12019/6/4
XYZ5Branch 32019/6/5
XYZ6Branch 32019/6/6
XYZ7Branch 12019/6/7
XYZ8Branch 32019/6/8
XYZ9Branch 22019/6/9
XYZ10Branch 12019/6/10
XYZ11Branch 32019/6/11
XYZ12Headquarters2019/6/12
XYZ13Branch 22019/6/13
XYZ14Branch 32019/6/14
XYZ15Branch 32019/6/15

 

Table in Power BI

 Units
 June
Branch 14
Branch 23
Branch 36
Headquarters2
 13

 

In the table above, the total is calculated as SUM(B3,B4,B5), leaving the 2 units of "Headquarters" out of the result, but still shown. 

My current formula in Power BI is: Units= if([Unit]<>"",1,0), which would give a total of 15

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

Hi @avalos 

 

try this MEASURE

Measure =
IF (
    HASONEFILTER ( Table1[Branch] ),
    COUNT ( Table1[Unit] ),
    SUMX (
        FILTER ( Table1, Table1[Branch] <> "Headquarters" ),
        CALCULATE ( COUNT ( Table1[Unit] ) )
    )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

Hi @avalos 

 

try this MEASURE

Measure =
IF (
    HASONEFILTER ( Table1[Branch] ),
    COUNT ( Table1[Unit] ),
    SUMX (
        FILTER ( Table1, Table1[Branch] <> "Headquarters" ),
        CALCULATE ( COUNT ( Table1[Unit] ) )
    )
)

Regards
Zubair

Please try my custom visuals

@Zubair_Muhammad Thanks a lot! It worked perfectly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors