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,100 points
47 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
+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
• 36,220 points

Related Questions In Power BI

0 votes
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
• 14,080 points
1,318 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
• 14,080 points
61 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
• 36,220 points
87 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,110 points
378 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,100 points

edited Oct 11, 2018 by Kalgi 95 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
• 14,080 points
86 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
• 14,080 points
1,010 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
• 14,080 points
53 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 22 in Power BI by VNK
4,404 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
• 36,220 points
2,666 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.