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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
callum8004
Regular Visitor

Calculated column based on two date columns

Hi

 

First post and brand new to Power BI.

 

I have a table that has two columns that contain dates as followls

 

Customer IDPostal ApplicationOnline ApplicationApplication
00119/2/2022  
002 14/7/2022 
003   
00412/7/202216/7/2022 

 

GOAL: I need the Application Column to state either "Postal", "Online" "No Application" based on col2 and col3 of this table. The part which I'm finding hard here is that I cannot do this in Power Query as col2&3 come from other tables via the related() function and I also need col4 to still use "Postal" if there is a date in both columns. Ive tried nestedIFs but just spent hours going round and round - anyone shed any light on how to achieve this?

 

1 ACCEPTED SOLUTION
SpartaBI
Community Champion
Community Champion

@callum8004 write this calculated column:

 

Application = 
VAR _postal = 'Table'[Postal Application]
VAR _online = 'Table'[Online Application]
VAR _result = 
    SWITCH(
        TRUE(),
        _postal <> BLANK() && _online <> BLANK(), "Both",
        _postal <> BLANK(), "Postal",
        _online <> BLANK(), "Online",
        "No Application"
    )
RETURN
    _result

 

SpartaBI_1-1658414742953.png

 

 


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

View solution in original post

3 REPLIES 3
SpartaBI
Community Champion
Community Champion

@callum8004 write this calculated column:

 

Application = 
VAR _postal = 'Table'[Postal Application]
VAR _online = 'Table'[Online Application]
VAR _result = 
    SWITCH(
        TRUE(),
        _postal <> BLANK() && _online <> BLANK(), "Both",
        _postal <> BLANK(), "Postal",
        _online <> BLANK(), "Online",
        "No Application"
    )
RETURN
    _result

 

SpartaBI_1-1658414742953.png

 

 


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

Anonymous
Not applicable

@callum8004 if you have both col2 and col3 in the same table now, you can directly use switch case column using DAX Switch function.

If you want it to be in power query, then use MERGE QURIES option with left outer join and get only col3 then using conditional column you can create this.

 

let me know if that helps.

 

johnt75
Super User
Super User

You can add a calculated column like

Application =
SWITCH (
    TRUE (),
    NOT ISBLANK ( 'Table'[Postal] ), "Postal",
    NOT ISBLANK ( 'Table'[Online] ), "Online",
    "No Application"
)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

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.