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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
rsch91
Helper I
Helper I

date in table using date/time variable from another table

The company I work for has data sets for us to work with, and in one of those data sets is a certain date/time variable. Let's call it DATEX. 

 

I want to use this variable in another table, but only the date portion, not the time. So right now my DAX sort of looks like this:

 

SUMMARIZE(

        VARIABLEZ

        DATEX)

 

But: it's showing the date and time for DATEX, since it's a date/time variable. I can't change the data type in the source (DATEX), my company has disallowed this. How do I put DATEX in the table using only the date?

 

Thank you. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @rsch91 ,

Based on the description, creating a calculated column.

FormattedDATEX = FORMAT('Table'[DATEX], "yyyy-mm-dd")

Then, creating a new table.

NewTable = 
SUMMARIZE(
    'Table',
    'Table'[FormattedDATEX]
)

Besides, creating a new calculated column.

NewCalculatedColumn = 
IF(
    NETWORKDAYS(MIN('Table'[DATEX]), NewTable[FormattedDATEX], 1, {DATE(2024,11, 6)}) < 0, 
    BLANK(),
    NETWORKDAYS(MIN('Table'[DATEX]), NewTable[FormattedDATEX], 1, {DATE(2024,11,6)})
)

vjiewumsft_0-1730880523991.png

 

Best Regards,

Wisdom 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

8 REPLIES 8
Anonymous
Not applicable

Hi @rsch91 ,

Based on the description, creating a calculated column.

FormattedDATEX = FORMAT('Table'[DATEX], "yyyy-mm-dd")

Then, creating a new table.

NewTable = 
SUMMARIZE(
    'Table',
    'Table'[FormattedDATEX]
)

Besides, creating a new calculated column.

NewCalculatedColumn = 
IF(
    NETWORKDAYS(MIN('Table'[DATEX]), NewTable[FormattedDATEX], 1, {DATE(2024,11, 6)}) < 0, 
    BLANK(),
    NETWORKDAYS(MIN('Table'[DATEX]), NewTable[FormattedDATEX], 1, {DATE(2024,11,6)})
)

vjiewumsft_0-1730880523991.png

 

Best Regards,

Wisdom Wu

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

 

AnalyticPulse
Solution Sage
Solution Sage

for date format you can add calculated columnn using this dax:
Formatteddate = FORMAT([datecolumn], "MM/DD/YYYY")
you will get thiss format:
11/05/2024

Thanks! That has worked. I created a column called "formatted DATEX" Now how do I work with DATEX to create a new column in the same new table? 

 

IF(
                    NETWORKDAYS(MIN(Dim_table[DATEZ]), DATEX, 1, tabel_vakantiedagen) < 0, BLANK(),
                                NETWORKDAYS(MIN(Dim_Table[DATEZ]), DATEX], 1, tabel_vakantiedagen))
 
Right now it's working with DATEX in the date/time-format. Just want it to work with the date only. So I can't refer to "formatted  DATEX"-date column in the calculated table. How do I make sure it works with the date only in this DAX-formula? 

@rsch91 
you can refer the new column in your dax instead of old datecolumn, it will be similar to your datetime column just that it wont have time part, only dates.

The thing is, it won't let me refer to the new column in the IF-formula. 

why?

AnalyticPulse
Solution Sage
Solution Sage

have you tried using format function for date format?

I am an absolute newbie to DAX, could you show me how to use it? Thank you. 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.