cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Working with case statement in power bi

I have a query including a case statement(copied below) that run in SQL Server 2012 and I just took it into Power BI. 

My slicer visual (Join Date Range) equals the Case statement from SQL Server:

 

case
when mbr_join_date>=getdate()-7 then 'Last Week'
when mbr_join_date>=getdate()-30 then 'Last Month'
when mbr_join_date>=getdate()-60 then 'Last 60 Days'
when mbr_join_date>=getdate()-90 then 'Last 90 Days'
else 'Last Fiscal Year'

Capture.JPG

 

 

 

 

 

 

 

 

 

 

 

A little bit about data: People are basically joining an organization and as of now the slicer works as a case statament meaning once I choose 'Last Week' Joins I get person A,B and C, however, when I choose 'Last Month' I would expect person A.B,C to be included in the result set but they are not. I know it is because my sql case statement eliminates those. 

 

Can you please advice how can I accomplish person A,B, and C appear in both, 'Last Week' and 'Last Month' and basically in other options too? 

It doesn't matter if the solution is in SQL or power bi as long as it works.

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Working with case statement in power bi

@lukaspowerbi,

 

Based on your requirements, you could use the relative date slicer.

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

3 REPLIES 3
Highlighted
Resolver III
Resolver III

Re: Working with case statement in power bi

Hello, @lukaspowerbi
Try this approach I think, is ideal for you case

Highlighted
Community Support
Community Support

Re: Working with case statement in power bi

@lukaspowerbi,

 

Based on your requirements, you could use the relative date slicer.

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

Highlighted
Helper II
Helper II

Re: Working with case statement in power bi

@v-chuncz-msft 

Thank you. Works great.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors