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
lukaspowerbi
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
v-chuncz-msft
Community Support
Community Support

@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
v-chuncz-msft
Community Support
Community Support

@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.

@v-chuncz-msft 

Thank you. Works great.

popov
Resolver III
Resolver III

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

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