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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
MichalSimota
Frequent Visitor

How to build condition?

Hi all

 

I have in formula this condition:

FILTER
	(CROSSJOIN(Downtime;'HourOfDay');
		HOUR(Downtime[Start])<='HourOfDay'[Hour of Day]&&HOUR     
                (Downtime[End])>='HourOfDay'[Hour of Day]
      )

I need to add additnal lines to make it working as I want, but don't know how to build DAX formula.

 

I want to add those lines into filter table.

Many thanks

Michal

DAY(Downtime[Start])<>DAY(Downtime[End]) then show lines where HourOfDay'[Hour of Day]>=HOUR(Downtime[Start])
plus
DAY(Do
wntime[Start])<>DAY(Downtime[End]) then show lines where HourOfDay'[Hour of Day]<=HOUR(Downtime[End])
1 ACCEPTED SOLUTION

@MichalSimota,

 

Just use the logical OR operator (||) to combine expressions.

https://docs.microsoft.com/en-us/dax/dax-operator-reference#logical-operators

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
AlB
Community Champion
Community Champion

Hi @MichalSimota

 

Is this correct? You are showing the same (in red) on both conditions

 

DAY(Downtime[Start])<>DAY(Downtime[End]) then show lines where HourOfDay'[Hour of Day]>=HOUR(Downtime[Start])
plus
DAY(Do
wntime[Start])<>DAY(Downtime[End]) then show lines where HourOfDay'[Hour of Day]<=HOUR(Downtime[End])

 

Hi

 

What I need to achieve by this is to show downtime for each hour(not just for start or end hour) so I need to filter all lines which are between start and end hour. It's done by fist formula:

HOUR(Downtime[Start])<='HourOfDay'[Hour of Day]&&HOUR (Downtime[End])>='HourOfDay'[Hour of Day]

 

But because some downtimes continue from one day to another, just this formula is not enough for such downtimes( when it start at 23:00 and finish at 01:00) So for those cases I need to add condittion to see also those hours. My idea was to add those conditions, so I tried it several times to build fomula but it did not work.

 

So Idea was to add comparison of days: DAY(Downtime[Start])<>DAY(Downtime[End]) and if this condition is walid, than I need to filter lines wich have this HourOfDay'[Hour of Day]>=HOUR(Downtime[Start]) or this HourOfDay'[Hour of Day]<=HOUR(Downtime[End]) condition.

 

Thanks

Michal

@MichalSimota,

 

Just use the logical OR operator (||) to combine expressions.

https://docs.microsoft.com/en-us/dax/dax-operator-reference#logical-operators

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AlB
Community Champion
Community Champion

@MichalSimota

Can you show the structure of your tables 'Downtime' and  'Hour of Day'? or share the pbix?

It'd be easier to come up with a solution with that info

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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