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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

JOIN 2 tables in DAX with a WHERE condition

Hi Below is my meausre. but now I have to join another table called Order on customer.id = order.customerid WHERE order.type = 'Y'
I need to add the above condition to the below measure .
can some please adivice me on how I add this ?
Many Thanks

CurrentReservations =
VAR PrevSunday = TODAY() - WEEKDAY(TODAY(),2)
VAR PrevMonday = PrevSunday - 6
RETURN CALCULATE (COUNTROWS('customer') , FILTER(ALL('Date') , 'Date'[Date] >= PrevMonday && 'Date'[Date] <= PrevSunday))

1 ACCEPTED SOLUTION

@Anonymous , for true we can level only order type

 

CurrentReservations =
VAR PrevSunday = TODAY() - WEEKDAY(TODAY(),2)
VAR PrevMonday = PrevSunday - 6
RETURN CALCULATE (COUNTROWS('customer') , FILTER(ALL('Date') , 'Date'[Date] >= PrevMonday && 'Date'[Date] <= PrevSunday) , FILTER(Order, Order[Type] ))

 

or

 

CurrentReservations =
VAR PrevSunday = TODAY() - WEEKDAY(TODAY(),2)
VAR PrevMonday = PrevSunday - 6
RETURN CALCULATE (COUNTROWS('customer') , FILTER(ALL('Date') , 'Date'[Date] >= PrevMonday && 'Date'[Date] <= PrevSunday) , FILTER(Order, Order[Type] =false() )) // you can also use true() 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi Amit, thanks for this but my order type is a text. it has TRUE and FALSE values. can you please modify your query slightly to match this ?

Many Thanks

@Anonymous , for true we can level only order type

 

CurrentReservations =
VAR PrevSunday = TODAY() - WEEKDAY(TODAY(),2)
VAR PrevMonday = PrevSunday - 6
RETURN CALCULATE (COUNTROWS('customer') , FILTER(ALL('Date') , 'Date'[Date] >= PrevMonday && 'Date'[Date] <= PrevSunday) , FILTER(Order, Order[Type] ))

 

or

 

CurrentReservations =
VAR PrevSunday = TODAY() - WEEKDAY(TODAY(),2)
VAR PrevMonday = PrevSunday - 6
RETURN CALCULATE (COUNTROWS('customer') , FILTER(ALL('Date') , 'Date'[Date] >= PrevMonday && 'Date'[Date] <= PrevSunday) , FILTER(Order, Order[Type] =false() )) // you can also use true() 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Worked like a charm. Thank you so much Amit. you are Star. 

amitchandak
Super User
Super User

@Anonymous , if they are already join in power bi

 

CurrentReservations =
VAR PrevSunday = TODAY() - WEEKDAY(TODAY(),2)
VAR PrevMonday = PrevSunday - 6
RETURN CALCULATE (COUNTROWS('customer') , FILTER(ALL('Date') , 'Date'[Date] >= PrevMonday && 'Date'[Date] <= PrevSunday) , FILTER(Order, Order[Type] =1))

 

 

also refer for wow , if needed

Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123
https://www.youtube.com/watch?v=pnAesWxYgJ8

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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