cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nick_2510
Helper I
Helper I

IF Conditions

Hi everyone!

I need to add one option in IF constraction...

switch off name if name in a period - data for this is in another table with colomns (Name, Start_period, End_Period)

 

working constration:

 

Count of -ve =

SUMX (
CROSSJOIN ( VALUES ('Календарь'[Date]), VALUES ( Data[Name] ) ),
IF ( [diff_AvSal_bal] < -1, 1, 0 )
)

I try to add condition  in IF constraction, but it doesnt work

 

Count of -ve =

SUMX (
CROSSJOIN ( VALUES ('Календарь'[Date]), VALUES ( Data[Name] ) ),
IF ( [diff_AvSal_bal] > 0 OR 'Календарь'[Date] IN DATESBETWEEN('Sheet1'['Start_per'], 'Sheet1'['End_per']'), 0, 1 )
)


1 ACCEPTED SOLUTION
tamerj1
Community Champion
Community Champion

@Nick_2510 
Please try

Count of -ve =
SUMX (
    CROSSJOIN ( VALUES ( 'Календарь'[Date] ), VALUES ( Data[Name] ) ),
    CALCULATE (
        IF (
            [diff_AvSal_bal] > 0
                || 'Календарь'[Date]
                    IN CALENDAR (
                        CALCULATE ( MAX ( 'Sheet1'[Start_per] ) ),
                        CALCULATE ( MAX ( 'Sheet1'[End_per] ) )
                    ),
            0,
            1
        )
    )
)

View solution in original post

6 REPLIES 6
tamerj1
Community Champion
Community Champion

@Nick_2510 
Here you go https://we.tl/t-j2udW5gRf0

OOS = 
SUMX (
    CROSSJOIN ( VALUES ('Календарь'[Date]), VALUES ( Glossary[Name] ) ),
    IF ( [diff_AvSal_bal] < -1 
        || 'Календарь'[Date] IN 
        CALENDAR ( 
            CALCULATE ( SELECTEDVALUE ( delist[Start_per] ) ), 
            CALCULATE ( SELECTEDVALUE ( delist[End_per] ) ) 
        ),
    1, 0 )
)

  

tamerj1
Community Champion
Community Champion

@Nick_2510 
This one is the latest solution I shared. Please download the file and check

tamerj1
Community Champion
Community Champion

Hi @Nick_2510 
Please try

Count of -ve =
SUMX (
    CROSSJOIN ( VALUES ( 'Календарь'[Date] ), VALUES ( Data[Name] ) ),
    CALCULATE (
        IF (
            [diff_AvSal_bal] > 0
                || 'Календарь'[Date]
                    IN CALENDAR ( MAX ( 'Sheet1'[Start_per] ), MAX ( 'Sheet1'[End_per] ) ),
            0,
            1
        )
    )
)

@tamerj1 

It almost works, but the last month (Apr 2022) doesnt calculate...in total(....it is really strange...because with other months everything is OK

Nick_2510_0-1652698020900.png

 

tamerj1
Community Champion
Community Champion

@Nick_2510 
Please try

Count of -ve =
SUMX (
    CROSSJOIN ( VALUES ( 'Календарь'[Date] ), VALUES ( Data[Name] ) ),
    CALCULATE (
        IF (
            [diff_AvSal_bal] > 0
                || 'Календарь'[Date]
                    IN CALENDAR (
                        CALCULATE ( MAX ( 'Sheet1'[Start_per] ) ),
                        CALCULATE ( MAX ( 'Sheet1'[End_per] ) )
                    ),
            0,
            1
        )
    )
)
tamerj1
Community Champion
Community Champion

@Nick_2510 
One possiblity is having blank start dates. 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors