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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
shahinnakhai
Frequent Visitor

undefinedFiscal period in Direct mode vs Import file

import reportimport report

 

direct reportdirect report

 

Hello,


thank you for the class. I want to create a report on the direct mode from SQL and calculate employment status of each month. I can easily do that on import mode with adding Fiscal Period on my data section or write

the M code (Fiscal Period = LEFT(LaborRoster[FISCPER],FIND("0",LaborRoster[FISCPER],1)+2) & "/" & RIGHT(LaborRoster[FISCPER],2)& "/01" )

but when it comes to Direct none of those work and it says Power BI doesn't support for direct mode. Also for M code there is something wrong for FIND function that give me error that I changed it to ( FIND("0", LaborRoster[FISCPER],1,0)+2) ) that is still wrong and doesn't show the name just date.

can you please help me on that?

Or give me an idea to make it like import file.

here is snapshots of different I get on the report

 

 
 

 

Thank you

1 ACCEPTED SOLUTION

Hi @shahinnakhai ,

 

We can create a Hierarchy using following calculated colmun after we format the calculated column Fiscal Period as a Date:

 

 

1.jpg

 

Fiscal Period Year = YEAR('LaborRoster'[Fiscal Period])

 

Fiscal Period Quartar = "Qtr " & QUARTER('LaborRoster'[Fiscal Period])

 

Fiscal Period Month =
SWITCH (
    MONTH ( 'LaborRoster'[Fiscal Period] ),
    1, "January",
    2, "February",
    3, "March",
    4, "April",
    5, "May",
    6, "June",
    7, "July",
    8, "August",
    9, "Sepember",
    10, "October",
    11, "November",
    12, "December"
)

 

Fiscal Period Day = DAY('LaborRoster'[Fiscal Period])

 

2.jpg

 


Best regards,

 

Community Support Team _ Dong Li
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

5 REPLIES 5
v-lid-msft
Community Support
Community Support

Hi @shahinnakhai ,

 

If the FISCPER column is like 9999001/2019, we can create a calculated column using following dax to meet your requiremetn:

 

Fiscal Period = 
RIGHT (
    'LaborRoster'[FISCPER],
    LEN ( [FISCPER] ) - FIND ( "/", 'LaborRoster'[FISCPER], 1, 0 )
) & "/"
    & RIGHT ( LEFT ( [FISCPER], FIND ( "/", 'LaborRoster'[FISCPER], 1, 0 ) - 1 ), 2 ) & "/01"

 

4.jpg

 


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

thank you for your help but still it came with number not name letter

Capture3.PNG

Hi @shahinnakhai ,

 

Please try to create the following calculated column and format it as the "Date" and "MMMM d":

 

Fiscal Period Date = 
DATE ( 
    RIGHT ( 'LaborRoster'[FISCPER], LEN ( [FISCPER] ) - FIND ( "/", 'LaborRoster'[FISCPER], 1, 0 )),
    RIGHT ( LEFT ( [FISCPER], FIND ( "/", 'LaborRoster'[FISCPER], 1, 0 ) - 1 ), 2 ),
    1
)

 

1.jpg

 

If it does not work, please use the following version:

 

Fiscal Period Date = 
DATE ( 
    VALUE(RIGHT ( 'LaborRoster'[FISCPER], LEN ( [FISCPER] ) - FIND ( "/", 'LaborRoster'[FISCPER], 1, 0 ))),
    VALUE(RIGHT ( LEFT ( [FISCPER], FIND ( "/", 'LaborRoster'[FISCPER], 1, 0 ) - 1 ), 2 )),
    1
)

 

Sorry for that we can not share the sample pbix file because it is using DirectQuery Mode.


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Unfortunately didn't work. It is going to name it as Jan and Feb but the issue is Power BI doesn't take Fiscal period as date with hierarchy of date with year, quarter, month and day. and Hierarchy doesn't get populated.

import

Capture.PNG

Direct

Capture1.PNG

 

Thanks

Hi @shahinnakhai ,

 

We can create a Hierarchy using following calculated colmun after we format the calculated column Fiscal Period as a Date:

 

 

1.jpg

 

Fiscal Period Year = YEAR('LaborRoster'[Fiscal Period])

 

Fiscal Period Quartar = "Qtr " & QUARTER('LaborRoster'[Fiscal Period])

 

Fiscal Period Month =
SWITCH (
    MONTH ( 'LaborRoster'[Fiscal Period] ),
    1, "January",
    2, "February",
    3, "March",
    4, "April",
    5, "May",
    6, "June",
    7, "July",
    8, "August",
    9, "Sepember",
    10, "October",
    11, "November",
    12, "December"
)

 

Fiscal Period Day = DAY('LaborRoster'[Fiscal Period])

 

2.jpg

 


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.