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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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() 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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() 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
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

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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