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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Chas2002
Helper III
Helper III

KeepFilter Help Needed

Hi Everyone,

 

Working with a Matrix table and almost have all my issues resolved.  This code (to create a measure with value = 00:00:00 (hh:mm:ss)) is working great. 

 

However, it's ignoring the in-place filter from the MS visual slicer.  I have 'both' turned on in the relationship...

 

How do I wrap this puppy (code below)  in a KEEPFilter command?

 

ACD Time (min) = VAR TotalSeconds=SUMX('agent_interval',HOUR('agent_interval'[acdTime_i_HHMMSS])*3600+MINUTE('agent_interval'[acdTime_i_HHMMSS])*60+SECOND('agent_interval'[acdTime_i_HHMMSS]))
VAR Days =TRUNC(TotalSeconds/3600/24)
VAR Hors = TRUNC((TotalSeconds-Days*3600*24)/3600)
VAR Mins =TRUNC(MOD(TotalSeconds,3600)/60)
VAR Secs = MOD(TotalSeconds,60)
return IF(DAYS=0,"",IF(DAYS>1,DAYS&"days ",Days&"day"))&IF(Hors=0,"0"&Hors,Hors)&":"&IF(Mins=0,"0"&Mins,Mins)&":"&IF(Secs=0,"0"&Secs,Secs)

Thanks,

Chas

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @Chas2002

 

Do you mean, you want to make sure filters set external to the matrix are applied to the calculation?

 

If so, try this....

 

ACD Time (min) = VAR TotalSeconds=SUMX(ALLSELECTED('agent_interval') ,HOUR('agent_interval'[acdTime_i_HHMMSS])

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @Chas2002

 

Do you mean, you want to make sure filters set external to the matrix are applied to the calculation?

 

If so, try this....

 

ACD Time (min) = VAR TotalSeconds=SUMX(ALLSELECTED('agent_interval') ,HOUR('agent_interval'[acdTime_i_HHMMSS])

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

HI @Chas2002

 

Plus I think there is a better way to format your result.  Do you have some sample data from your 'agent_interval'[actTime_i_HHMMSS] column including your desired output for the data.  Oh and what is the datatype for that column?

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.