Power Bi Dax Table

0 votes

I am trying to create a time table to make a filter range between 0 and 23 hs. 

I am using Power BI Desktop and this is the DAX calculated table syntax:

DateTime = 
ADDCOLUMNS (
    CROSSJOIN(
        CALENDAR(DATE(2000;1;1);DATE(2025;12;31));
        UNION (
            ROW ( "Time"; TIME ( 1; 0; 0 ) );
            ROW ( "Time"; TIME ( 2; 0; 0 ) );
            ROW ( "Time"; TIME ( 3; 0; 0 ) );
            ROW ( "Time"; TIME ( 4; 0; 0 ) );
            ROW ( "Time"; TIME ( 5; 0; 0 ) );
            ROW ( "Time"; TIME ( 6; 0; 0 ) );
            ROW ( "Time"; TIME ( 7; 0; 0 ) );
            ROW ( "Time"; TIME ( 9; 0; 0 ) );
            ROW ( "Time"; TIME ( 10; 0; 0 ) );
            ROW ( "Time"; TIME ( 11; 0; 0 ) );
            ROW ( "Time"; TIME ( 12; 0; 0 ) );
            ROW ( "Time"; TIME ( 13; 0; 0 ) );
            ROW ( "Time"; TIME ( 14; 0; 0 ) );
            ROW ( "Time"; TIME ( 15; 0; 0 ) );
            ROW ( "Time"; TIME ( 16; 0; 0 ) );
            ROW ( "Time"; TIME ( 17; 0; 0 ) );
            ROW ( "Time"; TIME ( 18; 0; 0 ) );
            ROW ( "Time"; TIME ( 19; 0; 0 ) );
            ROW ( "Time"; TIME ( 20; 0; 0 ) );
            ROW ( "Time"; TIME ( 21; 0; 0 ) );
            ROW ( "Time"; TIME ( 22; 0; 0 ) );
            ROW ( "Time"; TIME ( 23; 0; 0 ) );
            ROW ( "Time"; TIME ( 24; 0; 0 ) )
        )
    );
    "DateTime"; [Date] + [Time];
    "Hour"; HOUR ( [Time] )
)

This gives me syntax error on ; (I've tried "," either). There is some easy stuff that I writing it wrongly I am pretty sure, where is the error / errors? Thanks

Oct 5, 2018 in Power BI by lina
• 8,220 points
1,156 views

1 answer to this question.

+1 vote

You need to wrap the numbers in quotes like shown in the following example

DateTime = 
ADDCOLUMNS (
    CROSSJOIN(
        CALENDAR(DATE("2000","1","1"),DATE("2025","12","31")),
        UNION (
            ROW ( "Time", TIME ( "1", "0", "0" ) ),
            ROW ( "Time", TIME ( "2", "0", "0" ) ),
            ROW ( "Time", TIME ( "3", "0", "0" ) ),
            ROW ( "Time", TIME ( "4", "0", "0" ) ),
            ROW ( "Time", TIME ( "5", "0", "0" ) ),
            ROW ( "Time", TIME ( "6", "0", "0" ) ),
            ROW ( "Time", TIME ( "7", "0", "0" ) ),
            ROW ( "Time", TIME ( "9", "0", "0" ) ),
            ROW ( "Time", TIME ( "10", "0", "0" ) ),
            ROW ( "Time", TIME ( "11", "0", "0" ) ),
            ROW ( "Time", TIME ( "12", "0", "0" ) ),
            ROW ( "Time", TIME ( "13", "0", "0" ) ),
            ROW ( "Time", TIME ( "14", "0", "0" ) ),
            ROW ( "Time", TIME ( "15", "0", "0" ) ),
            ROW ( "Time", TIME ( "16", "0", "0" ) ),
            ROW ( "Time", TIME ( "17", "0", "0" ) ),
            ROW ( "Time", TIME ( "18", "0", "0" ) ),
            ROW ( "Time", TIME ( "19", "0", "0" ) ),
            ROW ( "Time", TIME ( "20", "0", "0" ) ),
            ROW ( "Time", TIME ( "21", "0", "0" ) ),
            ROW ( "Time", TIME ( "22", "0", "0" ) ),
            ROW ( "Time", TIME ( "23", "0", "0" ) ),
            ROW ( "Time", TIME ( "24", "0", "0" ) )
        )
    ),
    "DateTime", [Date] + [Time],
    "Hour", HOUR ( [Time] )
)
answered Oct 5, 2018 by Kalgi
• 52,350 points

Related Questions In Power BI

+1 vote
1 answer

Is there a way to convert JSON data to readable table in power bi

Follow these steps step 1 - Click on ...READ MORE

answered Sep 24, 2018 in Power BI by Hannah
• 18,520 points
13,994 views
0 votes
1 answer

list reports with calculated percentage in Power BI using dax

Create a Measure called Total Revenue: Total Revenue = SUMX( ...READ MORE

answered Oct 22, 2018 in Power BI by Hannah
• 18,520 points
1,619 views
0 votes
1 answer

Power BI DAX expression more than 2 or conditon

Heyyy @Hannah, you just need remove or ([principlecode] = ...READ MORE

answered Oct 29, 2018 in Power BI by Kalgi
• 52,350 points
3,117 views
0 votes
1 answer

Pivot table drill down functionality in Power BI

There is a clear deficit in the ...READ MORE

answered Dec 3, 2018 in Power BI by Upasana
• 8,620 points
3,542 views
+3 votes
2 answers

Combine tables in Power BI

You can also achieve this using a ...READ MORE

answered Oct 5, 2018 in Power BI by lina
• 8,220 points

edited Oct 11, 2018 by Kalgi 2,464 views
0 votes
1 answer

Dax code for calculated columns

I would recommend you to adjust the ...READ MORE

answered Oct 22, 2018 in Power BI by Hannah
• 18,520 points
1,119 views
+1 vote
1 answer

Have column with multiple values in powerBI, for use with a slicer in power bi

It can be achieved depending on the result you ...READ MORE

answered Oct 22, 2018 in Power BI by Hannah
• 18,520 points
7,445 views
0 votes
1 answer

Dax query in power bi

Here is my table before I have ...READ MORE

answered Oct 22, 2018 in Power BI by Hannah
• 18,520 points
1,048 views
0 votes
2 answers

Power BI Dax Multiple IF AND Statements

HI I have Column Patient 12 13 14 15 18 IN Patient=12, 13 Out ...READ MORE

answered May 23, 2019 in Power BI by VNK
18,936 views
0 votes
1 answer

Distinct count filtered by condition using Power BI Dax

Try this, it should work: DistinctCountActiveMonths = CALCULATE( ...READ MORE

answered Oct 5, 2018 in Power BI by Kalgi
• 52,350 points
37,639 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP