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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Analitika
Post Prodigy
Post Prodigy

If date between months

How to write Switch statment if i need determine if date is between months or after date?

 

SWITCH(
TRUE(),
Max(Klients[klient]) = "JSC4" && DATESBETWEEN('Date'[Date],"2017-01","2017-12"), App,
DIVIDE(Percent0,100)
)

 

SWITCH(
TRUE(),
Max(Klients[klient]) = "JSC4" && MAx('Date'[sort_month]) >= "2019-11", 0,
DIVIDE(Percent0,100)
)
1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @Analitika ,

 

Please refer to the measure below:

 

 

Measure =
SWITCH (
    TRUE (),
    MAX ( Klients[klient] ) = "JSC4"
        && MAX ( 'Date'[Date] ) <= DATE ( 2017, 12, 31 )
        && MAX ( 'Date'[Date] ) >= DATE ( 2017, 1, 1 ), App,
    MAX ( Klients[klient] ) = "JSC4"
        && MAX ( 'Date'[sort_month] ) / 100
            + MAX ( 'Date'[YEAR] ) >= 2019.11, 0,
    DIVIDE ( Percent0, 100 )
)

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

View solution in original post

2 REPLIES 2
v-deddai1-msft
Community Support
Community Support

Hi @Analitika ,

 

Please refer to the measure below:

 

 

Measure =
SWITCH (
    TRUE (),
    MAX ( Klients[klient] ) = "JSC4"
        && MAX ( 'Date'[Date] ) <= DATE ( 2017, 12, 31 )
        && MAX ( 'Date'[Date] ) >= DATE ( 2017, 1, 1 ), App,
    MAX ( Klients[klient] ) = "JSC4"
        && MAX ( 'Date'[sort_month] ) / 100
            + MAX ( 'Date'[YEAR] ) >= 2019.11, 0,
    DIVIDE ( Percent0, 100 )
)

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

amitchandak
Super User
Super User

@Analitika , The information you have provided is not making the problem clear to me. Can you please explain with an example.

 

I have this column example.

 

Month Type = Switch( True(),
Date([Date]) = eomonth(Today(),-1),"Last Month" , //Last Month
Date([Date])= eomonth(Today(),0),"This Month" , //This Month
[Month Year]
)

 

 

In case of measure , you case >=  and < = Date(2018,01,01) or date from slicer

 

Month Type = Switch( True(),
Max(Date([Date])) = eomonth(Today(),-1),"Last Month" , //Last Month
Max(Date([Date]))= eomonth(Today(),0),"This Month" , //This Month
[Month Year]
)


Appreciate your Kudos.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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