Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors