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
Anonymous
Not applicable

Create Column flag based on 2 parameter

Hi Experts

 

i Have dataset with direct query mode in Postgresql, Need Help to create flag column "GOP FLAG" like below image,

 

image.png

 

 

 

 

 

if any approval_NO have GOP Activity then "GOP FLAG" Column must create GOP on All Approval_No Group, and Blank if they dont have GOP activity.
how can i do this with DAX?

Thank you

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi @Anonymous  , 

 

By your description , You mentioned that “Need Help to create flag column "GOP FLAG" ”, because

'CALCULATE' is not allowed as part of calculated column DAX expressions on DirectQuery models, so it's

suggested to create measure instead. 

GOP Flag =
VAR _A =
    CALCULATE (
        MAX ( [Approval_NO] ),
        FILTER ( ALLEXCEPT ( Table1, Table1[Approval_NO] ), [activity] = "GOP" ))
RETURN
    IF ( _A <> BLANK (), "GOP", " " )

The final output is shown below:

  v-yalanwu-msft_0-1620381299225.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.  

View solution in original post

6 REPLIES 6
v-yalanwu-msft
Community Support
Community Support

Hi @Anonymous  , 

 

By your description , You mentioned that “Need Help to create flag column "GOP FLAG" ”, because

'CALCULATE' is not allowed as part of calculated column DAX expressions on DirectQuery models, so it's

suggested to create measure instead. 

GOP Flag =
VAR _A =
    CALCULATE (
        MAX ( [Approval_NO] ),
        FILTER ( ALLEXCEPT ( Table1, Table1[Approval_NO] ), [activity] = "GOP" ))
RETURN
    IF ( _A <> BLANK (), "GOP", " " )

The final output is shown below:

  v-yalanwu-msft_0-1620381299225.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.  

Anonymous
Not applicable

Hi @v-yalanwu-msft 

 

Wowww, It Works good in my Report.

 

Thank you very much for helping me solved the problem.

Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

The below is for creating a new column.

 

Picture2.png

 

GOP Flag CC =
VAR currentapprovalno = 'Table'[Approval_NO]
RETURN
IF (
"GOP"
IN SUMMARIZE (
FILTER ( 'Table', 'Table'[Approval_NO] = currentapprovalno ),
'Table'[activity]
),
"GOP"
)
 

Hi, My name is Jihwan Kim.


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


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

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


Anonymous
Not applicable

Hello @Jihwan_Kim 

Thanks for your Respons, 

 

With your Formula i facing error like below

image.png

 

 

maybe because I used direct query mode, Can you please help me to solve this problem?

Thanks

Hi, @Anonymous 

Thank you for your feedback.

Oh, sorry that I missed your explanation about direct query mode.

Is it not possible to change it to import mode? I am not sure how to add the actual column in direct query mode.

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


Anonymous
Not applicable

Dear @Jihwan_Kim 

We need the report real time, so probably it cannot switched to import mode, 
i wish i could, hiks

 

but anw thanks for your help btw.

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.