cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HanumareddyV Frequent Visitor
Frequent Visitor

Want to develop a logic inside Power BI Desktop

Hi All,

Trying to achieve same condition in Power BI,Please Help me:

if(Calendar_Week_Relative = 0,
sum({$<$(vSetChart), Stocking_Order_Type={'Outbound'}, Calendar_Week_Relative = {'<=0'}>} Total Total_$(vMeasure)),
sum({$<$(vSetChart), Stocking_Order_Type={'Outbound'}, Calendar_Week_Relative = {'>0<=12'}>} Total_$(vMeasure)))

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Want to develop a logic inside Power BI Desktop

@HanumareddyV,

 

Check measure below and take a look at this article.

 

Measure 2 =
VAR w =
    SELECTEDVALUE ( Table1[week_relative] )
RETURN
    IF (
        NOT ( ISBLANK ( w ) )
            && w = 0,
        CALCULATE ( [Measure], Table1[week_relative] <= 0 ),
        [Measure]
    )

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
6 REPLIES 6
HanumareddyV Frequent Visitor
Frequent Visitor

Re: Want to develop a logic inside Power BI Desktop

Please ignore $(vSetChart) and Total_$(vMeasure), just want to impement If logic to Date dimenssion.

ryan_mayu Established Member
Established Member

Re: Want to develop a logic inside Power BI Desktop

@HanumareddyV

 

Could you please provide the screenshots of your sample data and the result you expected?

 

Thanks & BR

Ryan

Community Support Team
Community Support Team

Re: Want to develop a logic inside Power BI Desktop

@HanumareddyV,

 

You may use SUMX in DAX.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
HanumareddyV Frequent Visitor
Frequent Visitor

Re: Want to develop a logic inside Power BI Desktop

I don't have any sample data, Here i'm trying to achieve the solution like:
Sample Data:
week_relative:            Measure:
-1                               10
-2                               20
(Blank)                       30
0                                40
1                                 50
2                                 60
Trying to achieve,
if ([Week_relative]=0,
calculate(sum(measure),[week_relative]<=0    I.e. (10+20+30+40),
else show the result as it is
week_relative     Measure
1                          50

2                          60

Community Support Team
Community Support Team

Re: Want to develop a logic inside Power BI Desktop

@HanumareddyV,

 

Check measure below and take a look at this article.

 

Measure 2 =
VAR w =
    SELECTEDVALUE ( Table1[week_relative] )
RETURN
    IF (
        NOT ( ISBLANK ( w ) )
            && w = 0,
        CALCULATE ( [Measure], Table1[week_relative] <= 0 ),
        [Measure]
    )

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
HanumareddyV Frequent Visitor
Frequent Visitor

Re: Want to develop a logic inside Power BI Desktop

Sam,

It works fine, thnaks muuch for the help!!