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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

IF Statement - Custom Column + Measure

Hi all,

 

I have a table where the second last column (Total number of products launched) is a custom column, and the last column (number of products launched for the selected years) is a calculated measure using DAX language and it is the one that can adapt to the selected years filter. 

 

My goal is to add add a flag as a column/ calculated DAX measure with a condition, if the last 2 columns in the table are the same - the returning value is True otherwise, False. However, using a true or false column is displaying the same information: True. 

 

Please help! Thank you. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1655802262356.png

Here are the steps you can follow:

1. Create calculated column.

 

Total number of products launched_Column =
SUMX(FILTER(ALL('Table'),'Table'[Group]="launched"),[product number])

 

2. Create measure.

 

number of products launched for the selected years =
var _select=SELECTEDVALUE('Table'[Year])
return
SUMX(FILTER(ALL('Table'),'Table'[Group]="launched"&&'Table'[Year]<=_select),[product number])
Flag =
IF(
    MAX('Table'[Total number of products launched_Column])=[number of products launched for the selected years],"True","False")
Flag1 =
IF(
ISERROR(
        SEARCH("True",[Flag]))
    ,
    "true",
    [Flag]
)

 

3. Result:

vyangliumsft_1-1655802262358.png

 

Best Regards,

Liu Yang

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

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1655802262356.png

Here are the steps you can follow:

1. Create calculated column.

 

Total number of products launched_Column =
SUMX(FILTER(ALL('Table'),'Table'[Group]="launched"),[product number])

 

2. Create measure.

 

number of products launched for the selected years =
var _select=SELECTEDVALUE('Table'[Year])
return
SUMX(FILTER(ALL('Table'),'Table'[Group]="launched"&&'Table'[Year]<=_select),[product number])
Flag =
IF(
    MAX('Table'[Total number of products launched_Column])=[number of products launched for the selected years],"True","False")
Flag1 =
IF(
ISERROR(
        SEARCH("True",[Flag]))
    ,
    "true",
    [Flag]
)

 

3. Result:

vyangliumsft_1-1655802262358.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

PhilipTreacy
Super User
Super User

Hi @Anonymous 

 

Could you please supply your PBIX file or some sample data and examples of your table visual.  Really hard to get my head around this without seeing your data, your measure etc.

 

regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.