Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have an SP in SQL that uses date parameters not to filter the data but to assign values in a case statement. I'm trying to move this into Power BI but I'm struggling with the parameter.
What I'm trying now is I have a date table with a slicer assigned to it. My main dataset (Query1 for this example) is not linked to the date table. I have a few case statements where I want to get counts from Query1:
1. Query1.Date <= filtered start date AND (Query1.xxx ISBLANK() OR Query1.yyy <= 'SOME DATE')
2. Query1.Date exists in the filtered date table between the slicer dates
3. Similar to option 2 with an AND clause checking Query1.SomeField is in ('xxx','yyy','zzz')
Is this possible? What's the best solution? I don't want to filter the results but assign specific values based on the filtered date table/slicer.
Solved! Go to Solution.
Think I figured it out.
@TCavins Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
Think I figured it out.
My current Stored Procedure has @BeginDate and @EndDate as parameters. These do not filter the results but are used in a CASE statement to get a count.
CASE WHEN Date1 <= @StartDate AND (column1 is null OR column2 <= '1/1/2021') THEN 1 END as MyField1
WHEN Date1 BETWEEN @StartDate and @ENDDate THEN 1 END As MyField2
WHEN Date2 BETWEEN @StartDate and @EndDate AND (Column3 IN ('xxx','yyy')) THEN 1 END as MyField3
I don't want the end user having to modify parameters when viewing the App in the Power BI Service. So I thought I'd create a Date table with just a date column and apply a slicer to it. Then I would be able to create measures to determine the case statement above and use the slicer/date table instead of parameters to see if Date1 falls within the filtered/sliced table.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.