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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
dosinkevic
Frequent Visitor

IF statement or different solution?

How can I use IF statement in this case or it should be different solution?

 

I neet to run this formula only if Campaign {"date"} = CRM {"date"} then Column =....

Column = 
VAR __tmpTable = ADDCOLUMNS(ALL(crm),"Found",FIND([id],[camp_tracker],,-1))
RETURN COUNTROWS(FILTER(__tmpTable,[Found]<>-1))

 

1 ACCEPTED SOLUTION
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @dosinkevic,

 

Maybe you can try this formula.

Column =
VAR __tmpTable =
    ADDCOLUMNS ( ALL ( crm ), "Found", FIND ( [id], [camp_tracker],, -1 ) )
VAR campaign_date = [date]
RETURN
    COUNTROWS ( FILTER ( __tmpTable, [Found] <> -1 && [date] = campaign_date ) )

Best Regards,

Dale

Community Support Team _ Dale
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

4 REPLIES 4
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @dosinkevic,

 

Maybe you can try this formula.

Column =
VAR __tmpTable =
    ADDCOLUMNS ( ALL ( crm ), "Found", FIND ( [id], [camp_tracker],, -1 ) )
VAR campaign_date = [date]
RETURN
    COUNTROWS ( FILTER ( __tmpTable, [Found] <> -1 && [date] = campaign_date ) )

Best Regards,

Dale

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

Dale,

It works, thank you for help!

chotu27
Post Patron
Post Patron

@dosinkevic Use the Conditional column feature in editqueries so that you can keep your condition there.

In my case I have two queries Campaign and CRM. I can't select both in  Conditional column, plus I can't add my formula in Output.

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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