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
Candice_Lyons
New Member

Trying to tell powerBI not to include something in a trend calculation

Hi there,

 

I am trying to calculate a trend between two columns of text that I have coded for hierarchical responses. This code works for telling it to not calculate a trend when one of my fields is blank:

 

TREND_SIGN = IF(NOT(ISBLANK('Threats'[TREND_code])),SIGN(LOOKUPVALUE('Threats'[TREND.CODE in Power BI],'Threats'[SOPParkID],[SOPParkID],
'Threats'[EvaluationPeriod],[EvaluationPeriod]-3-INT(([EvaluationPeriod]-2010)/6),
'Threats'[Response title reporting],[Response title reporting],'Threats'[KeyColumnValue],
[KeyColumnValue],0)-[TREND.CODE in Power BI]))

 

I now need to add in here another code to tell it if [previous evaluation] = blank, then don't calculate a trend? 

 

Is this possible? 

2 REPLIES 2
Candice_Lyons
New Member

I should have put a list of what hasn't worked here... Neither of these worked:

 

1// 

 

IF(NOT(ISBLANK('Threats'[TREND_code]))
|| NOT ( ISBLANK('Threats'[PREVIOUS_RESPONSE])),SIGN(LOOKUPVALUE('Threats'[TREND.CODE in Power BI],'Threats'[SOPParkID],[SOPParkID],
'Threats'[EvaluationPeriod],[EvaluationPeriod]-3-INT(([EvaluationPeriod]-2010)/6),
'Threats'[Response title reporting],[Response title reporting],'Threats'[KeyColumnValue],
[KeyColumnValue],0)-[TREND.CODE in Power BI]))

 

 

2//

 

TREND_SIGN = IF(NOT(ISBLANK('Threats'[TREND_code]))

&& NOT ( ISBLANK([PREVIOUS_RESPONSE])),SIGN(LOOKUPVALUE('Threats'[TREND.CODE in Power BI],'Threats'[SOPParkID],[SOPParkID],

'Threats'[EvaluationPeriod],[EvaluationPeriod]-3-INT(([EvaluationPeriod]-2010)/6),

'Threats'[Response title reporting],[Response title reporting],'Threats'[KeyColumnValue],

[KeyColumnValue],0)-[TREND.CODE in Power BI]))

Jihwan_Kim
Super User
Super User

Hi, 

I am not sure how your datamodel looks like, but please try using && DAX function or || DAX function.

It represents AND or OR. Please check the link down below.

And, please try the below measure whether it suits your requirement.

 

And (&&) – DAX Guide

Or (||) – DAX Guide

 

TREND_SIGN =
IF (
    NOT ( ISBLANK ( 'Threats'[TREND_code] ) )
        && NOT ( ISBLANK ( [previous evaluation] ) ),
    SIGN (
        LOOKUPVALUE (
            'Threats'[TREND.CODE in Power BI],
            'Threats'[SOPParkID], [SOPParkID],
            'Threats'[EvaluationPeriod],
                [EvaluationPeriod] - 3
                    - INT ( ( [EvaluationPeriod] - 2010 ) / 6 ),
            'Threats'[Response title reporting], [Response title reporting],
            'Threats'[KeyColumnValue], [KeyColumnValue],
            0
        ) - [TREND.CODE in Power BI]
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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