Forum Discussion

harib's avatar
harib
Post Patron
7 years ago

IF conditional column

Hello Friends,

 

I want a conditional column in my table report like if condition or anything 

I have a 3 groups like BG, CMT, Country groups (column wise)

I would like to apply TARGET_PERCENT or TARGET_PERCENT_BG to BG group and CMT group

 

Formula logic 

Target=If (Query1[BG group] Or Query1[CMT group]) Then
If IsNull([Target Percent BG]) Or [Target Percent BG]=0 Then 80 Else [Target Percent BG]
Else
If IsNull([Target Percent]) Or [Target Percent]=0 Then 80 Else [Target Percent]

but it's not working

 

Can anyone give me the output based on above logic

i need a Output like below image

  • if i display Bg group or CMT group in table  TARGET (Calculated column)should come 
  • If i display Country group in table default value of Target Percent BG should come

 

Sample table link

 

https://drive.google.com/file/d/1a70xCMB8x76TvOnURqG20HCGYdgZuKJw/view?usp=sharing

 

 

4 Replies

    • harib's avatar
      harib
      Post Patron

      parry2k 

       

      We are migrating the reports from one platform to PowerBI. SO they have used fomula like that. Can we get output with our Dax logics instead of following their logic





      My project struck here. Help me 

       

      Thanks 

  • v-frfei-msft's avatar
    v-frfei-msft
    Community Support

    Hi harib ,

     

    Try this one.

    Target =
    VAR a =
        IF (
            ISBLANK ( [Target Percent BG] )
                || [Target Percent BG] = 0,
            80,
            [Target Percent BG]
        )
    VAR b =
        IF (
            ISBLANK ( [Target Percent] )
                || [Target Percent] = 0,
            80,
            [Target Percent]
        )
    RETURN
        a + b
    
    • harib's avatar
      harib
      Post Patron

      v-frfei-msft 

       

      Hi it's giving aggreagate value like below image, it should show only 1 value either 80 (or) Target Percent BG (or)  Target Percent table values.

      You have not mentioned any group in the formula if i'm not wrong

       

      Thanks for appriciate if you can provide best solution