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

How to create an IF statement in Power BI referencing 2 tables

Hi guys and girls,

 

I am new to power bi and im finding it rather challenging to create a measure based off 2 tables.

 

The tables i am using are Calendar(This is Dimension) and SalesMeasure(This is Fact)

 

So basically i want to create a SalesCY measure in my Fact table that indicates if the flag MTDCY_Flag = 1 then show Sales value else 0;

 

MTDCY_Flag is in Calendar table.

 

I tried to create something along the lines as ..

 

SalesCY = IF(Related('Calendar'[MTDCY_Flag = 1); 'SalesMeasures[SalesValue]; 0);

 

This doesn't work though. 

 

Thanks 

StarLord

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Sounds like you could you create a calculated column to diplay where MTDCY_Flag = 1.

 

Column = IF(MTDCY[Flag] = 1, "True", "False")
 
You could then use a visual filter to filter to only "True" values which you can then narrow down to where Sales = 0.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Sounds like you could you create a calculated column to diplay where MTDCY_Flag = 1.

 

Column = IF(MTDCY[Flag] = 1, "True", "False")
 
You could then use a visual filter to filter to only "True" values which you can then narrow down to where Sales = 0.
Anonymous
Not applicable

Thanks 


@Anonymous wrote:

Sounds like you could you create a calculated column to diplay where MTDCY_Flag = 1.

 

Column = IF(MTDCY[Flag] = 1, "True", "False")
 
You could then use a visual filter to filter to only "True" values which you can then narrow down to where Sales = 0.

 

 

Anonymous
Not applicable

Happy to help!

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.