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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
suchomelb
Helper I
Helper I

Specifying date range used for SWITCH

I've tried a few options like datesbetween with min and max date but I keep getting errors. I thought this wouldn't be as difficult as its proving to be.

I have a table with a date column and a parameter column that can switch out employee, manager, or nothing. Problem is when I have it just by date, when combined with the measure below, I am seeing everything in my date table. My data starts on March 1st but of course the date table is going back to Jan 1st. I want to only show from my min date to my max date in the date column of my main table. How would I acheive this?

 

Measure used in column: 

Test =
    SWITCH([Added marks], 0, "🔵", 1, "🟡",2, "🟠", 3, "🔴")

In case it matters, measure used for the SWITCH measure:
Added marks =
VAR Cond1 =
    IF ( [#Avg 1] > 1000, 1, 0 )
VAR Cond2 =
    IF ( [#Avg 2] > 800, 1, 0 )
VAR Cond3 =
    IF ( [#Avg 3] > 100, 1, 0 )
VAR AddedUp = ( Cond1 + Cond2 + Cond3 )
RETURN
    AddedUp
 
1 ACCEPTED SOLUTION
suchomelb
Helper I
Helper I

Figures i'd figure it out shortly after posting. I just put an IF statement before the SWITCH to get rid of any rows where one of my columns is greater than 0, thus removing everything where dates dont have data or any dates in between my date range that were empty, which it was grabbing as well.

View solution in original post

1 REPLY 1
suchomelb
Helper I
Helper I

Figures i'd figure it out shortly after posting. I just put an IF statement before the SWITCH to get rid of any rows where one of my columns is greater than 0, thus removing everything where dates dont have data or any dates in between my date range that were empty, which it was grabbing as well.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.