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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
curiouspbix0
Helper IV
Helper IV

Dax Aggregation Issue

 

Hello Daxers,

 

Running into an aggregation here, first table shows raw data, second table is the dax measure which computes correctly when Status column is not used in the table.


Actual is skewed when Status is added to the table, where did this go wrong ?

 

Raw Data

VehicleStatusVehicle Count
BikesRunning10
BikesActive20
BikesOOO8
CarsRunning10
CarsActive23
CarsOOO11
BoatsRunning100
BoatsActive30
BoatsOOO9
OtherRunning2

Actual = COUNTROWS(DISTINCT(TableVehicle[VehicleID]))
,FILTER(ALL(TableVehicle[Status])
,TableVehicle[VehicleStatus]="Running"
|| TableVehicle[VehicleStatus]="Active")
)

Raw Data with DAX

VehicleActual 
Bikes30
Cars33
Boats130
Other2

 

Actual Result Table - Incorrect

VehicleStatusActual
BikesRunning30
BikesActive30
BikesOOO30
CarsRunning33
CarsActive33
CarsOOO33
BoatsRunning130
BoatsActive130
BoatsOOO130
OtherRunning2

 

What DAX for field Status would result in the below table.

 

Expected Result Table - Correct

VehicleStatus Actual
BikesRunning10
BikesActive20
CarsRunning10
CarsActive23
BoatsRunning100
BoatsActive30
OtherRunning2

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @curiouspbix0 ,

You can create a measure as below:

Actual =
CALCULATE (
    SUM ( 'TableVehicle'[Vehicle Count] ),
    FILTER ( 'TableVehicle', 'TableVehicle'[Status] IN { "Running", "Active" } )
)

yingyinr_0-1623832254783.png

Best Regards

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @curiouspbix0 ,

You can create a measure as below:

Actual =
CALCULATE (
    SUM ( 'TableVehicle'[Vehicle Count] ),
    FILTER ( 'TableVehicle', 'TableVehicle'[Status] IN { "Running", "Active" } )
)

yingyinr_0-1623832254783.png

Best Regards

Singaravelu_R
Resolver III
Resolver III

In modeling click Net Table (write a dax expression to create new table) and write summarize DAX as per blow screenshot,

 

Singaravelu_R_0-1623669685026.png

 

amitchandak
Super User
Super User

@curiouspbix0 , remove all and try

 

Actual = COUNTROWS(DISTINCT(TableVehicle[VehicleID]))
,FILTER((TableVehicle)
,TableVehicle[VehicleStatus] in{"Running","Active"})
)

 

or

with allselected

 

Actual = COUNTROWS(DISTINCT(TableVehicle[VehicleID]))
,FILTER(allselected(TableVehicle)
,TableVehicle[VehicleStatus] in{"Running","Active"})
)

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

ALLSELECTED did not work and cannot remove ALL together on Filter condition. 

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors