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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Hussain
Helper I
Helper I

Measure to filter columns

Hi

 

I have a database table with a column named multimedia type which has 3 values - Video,Image,Other.

I want to create a Power BI Table for the category Video only.

I want to display the Multimedia File Name, Uploader Name, FileLength(in secs).

I don't want to  use Power BI filters. So, I create a measure like so - 

Total videos length (sec):=
CALCULATE (
SUM ( VaultAssets[FileLength] ),
FILTER ( VaultAssets, VaultAssets[VideoImageOther] = "Videos" )
)

When I put this measure as a column (alonng with other variables I mentioned above) in the Power BI table, I do get rows for only Videos. But the problem is that the actual database table (the source table) has Blanks for FileLength and this measure only displays rows with non blank FileLength values. I also tried other measures like - 

Video Length(Secs):=SUMX(FILTER(VaultAssets,VaultAssets[VideoImageOther]="Videos"),VaultAssets[FileLength])

 

VL:=
VAR fl = CALCULATE(SUM(VaultAssets[FileLength]),FILTER(VaultAssets,VaultAssets[VideoImageOther]="Videos"))
Return
IF(fl=BLANK(),0,fl)

 

:=IF(CALCULATE (
SUM ( VaultAssets[FileLength] ),
FILTER ( VaultAssets, VaultAssets[VideoImageOther] = "Videos" )
) = BLANK(),0,

CALCULATE (
SUM ( VaultAssets[FileLength] ),
FILTER ( VaultAssets, VaultAssets[VideoImageOther] = "Videos" )
)

)

 

None of them gives correct number of rows

 

Summing it up: I want to create a measure for only Videos which when put in a power BI table visual, gives me all the rows including blanks.

 

 

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

If you just want number of rows, use COUNTROWS: 

 

Videos =COUNTROWS(FILTER(VaultAssets,VaultAssets[VideoImageOther]="Videos"))

 

Otherwise, to replace blank with zero, try: 

 

Video Length(Secs):=SUMX(FILTER(VaultAssets,VaultAssets[VideoImageOther]="Videos"),IF(ISBLANK(VaultAssets[FileLength]), 0, VaultAssets[FileLength]))


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

1 REPLY 1
AllisonKennedy
Super User
Super User

If you just want number of rows, use COUNTROWS: 

 

Videos =COUNTROWS(FILTER(VaultAssets,VaultAssets[VideoImageOther]="Videos"))

 

Otherwise, to replace blank with zero, try: 

 

Video Length(Secs):=SUMX(FILTER(VaultAssets,VaultAssets[VideoImageOther]="Videos"),IF(ISBLANK(VaultAssets[FileLength]), 0, VaultAssets[FileLength]))


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors