cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Please help in forming the below table structure in PowerBI

Hi All, 

 

I have a table structure which is:

singh_gagan03_0-1594103889828.png

And I want to convert it into the below sample shown:

singh_gagan03_1-1594103957334.png

Why I am trying to achieve the above feat is that I want to map all the possible years and years-period to the corresponding years and years- period except itself. Further allocating the previous year as the last year (in this case 2019) and the years-period as "FY Actuals". Above thing, I tried to achieve by "CROSS JOIN" but it takes a whole lot of time to get executed.

 

But Once I achieved it then again I did a "CROSS JOIN" to get the mapping of period and quarters.

 

After that, for example, if the period lets say CC is 202006 then the P01-P05 should be "YTD" and rest as "YTG". But if it is "FY Actuals" flag for P01-P13 should be "YTG".

 

I am attaching the excel sheet for a better understanding of the user. Please let me know if further explanation is required.

CCCC YearLCLC YearLast Year CycleLast YearQuarterPeriodTime Indicator
20200520202020062020FY Actuals2019Q1P01YTD
20200520202020062020FY Actuals2019Q1P02YTD
20200520202020062020FY Actuals2019Q1P03YTD
20200520202020062020FY Actuals2019Q2P04YTD
20200520202020062020FY Actuals2019Q2P05YTD
20200520202020062020FY Actuals2019Q2P06YTG
20200520202020062020FY Actuals2019Q3P07YTG
20200520202020062020FY Actuals2019Q3P08YTG
20200520202020062020FY Actuals2019Q3P09YTG
20200520202020062020FY Actuals2019Q4P10YTG
20200520202020062020FY Actuals2019Q4P11YTG
20200520202020062020FY Actuals2019Q4P12YTG
20200520202020062020FY Actuals2019Q4P13YTG
2020052020FY Actuals2019FY Actuals2019Q1P01YTD
2020052020FY Actuals2019FY Actuals2019Q1P02YTD
2020052020FY Actuals2019FY Actuals2019Q1P03YTD
2020052020FY Actuals2019FY Actuals2019Q2P04YTD
2020052020FY Actuals2019FY Actuals2019Q2P05YTD
2020052020FY Actuals2019FY Actuals2019Q2P06YTG
2020052020FY Actuals2019FY Actuals2019Q3P07YTG
2020052020FY Actuals2019FY Actuals2019Q3P08YTG
2020052020FY Actuals2019FY Actuals2019Q3P09YTG
2020052020FY Actuals2019FY Actuals2019Q4P10YTG
2020052020FY Actuals2019FY Actuals2019Q4P11YTG
2020052020FY Actuals2019FY Actuals2019Q4P12YTG
2020052020FY Actuals2019FY Actuals2019Q4P13YTG
20200620202020052020FY Actuals2019Q1P01YTD
20200620202020052020FY Actuals2019Q1P02YTD
20200620202020052020FY Actuals2019Q1P03YTD
20200620202020052020FY Actuals2019Q2P04YTD
20200620202020052020FY Actuals2019Q2P05YTD
20200620202020052020FY Actuals2019Q2P06YTD
20200620202020052020FY Actuals2019Q3P07YTG
20200620202020052020FY Actuals2019Q3P08YTG
20200620202020052020FY Actuals2019Q3P09YTG
20200620202020052020FY Actuals2019Q4P10YTG
20200620202020052020FY Actuals2019Q4P11YTG
20200620202020052020FY Actuals2019Q4P12YTG
20200620202020052020FY Actuals2019Q4P13YTG
2020062020FY Actuals2019FY Actuals2019Q1P01YTD
2020062020FY Actuals2019FY Actuals2019Q1P02YTD
2020062020FY Actuals2019FY Actuals2019Q1P03YTD
2020062020FY Actuals2019FY Actuals2019Q2P04YTD
2020062020FY Actuals2019FY Actuals2019Q2P05YTD
2020062020FY Actuals2019FY Actuals2019Q2P06YTD
2020062020FY Actuals2019FY Actuals2019Q3P07YTG
2020062020FY Actuals2019FY Actuals2019Q3P08YTG
2020062020FY Actuals2019FY Actuals2019Q3P09YTG
2020062020FY Actuals2019FY Actuals2019Q4P10YTG
2020062020FY Actuals2019FY Actuals2019Q4P11YTG
2020062020FY Actuals2019FY Actuals2019Q4P12YTG
2020062020FY Actuals2019FY Actuals2019Q4P13YTG
FY Actuals20192020052020FY Actuals2019Q1P01YTD
FY Actuals20192020052020FY Actuals2019Q1P02YTD
FY Actuals20192020052020FY Actuals2019Q1P03YTD
FY Actuals20192020052020FY Actuals2019Q2P04YTD
FY Actuals20192020052020FY Actuals2019Q2P05YTD
FY Actuals20192020052020FY Actuals2019Q2P06YTD
FY Actuals20192020052020FY Actuals2019Q3P07YTD
FY Actuals20192020052020FY Actuals2019Q3P08YTD
FY Actuals20192020052020FY Actuals2019Q3P09YTD
FY Actuals20192020052020FY Actuals2019Q4P10YTD
FY Actuals20192020052020FY Actuals2019Q4P11YTD
FY Actuals20192020052020FY Actuals2019Q4P12YTD
FY Actuals20192020052020FY Actuals2019Q4P13YTD
FY Actuals20192020062020FY Actuals2019Q1P01YTD
FY Actuals20192020062020FY Actuals2019Q1P02YTD
FY Actuals20192020062020FY Actuals2019Q1P03YTD
FY Actuals20192020062020FY Actuals2019Q2P04YTD
FY Actuals20192020062020FY Actuals2019Q2P05YTD
FY Actuals20192020062020FY Actuals2019Q2P06YTD
FY Actuals20192020062020FY Actuals2019Q3P07YTD
FY Actuals20192020062020FY Actuals2019Q3P08YTD
FY Actuals20192020062020FY Actuals2019Q3P09YTD
FY Actuals20192020062020FY Actuals2019Q4P10YTD
FY Actuals20192020062020FY Actuals2019Q4P11YTD
FY Actuals20192020062020FY Actuals2019Q4P12YTD
FY Actuals20192020062020FY Actuals2019Q4P13YTD

TIA

 

Regards

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @singh_gagan03 ,

 

If you want to create the Time indicator column, we can use the following steps to meet your requirement.

 

1. Create a Period number column.

 

Period number = CONVERT(RIGHT('Table'[Period],LEN('Table'[Period])-1),INTEGER)

 

P1.jpg

 

2. Then we can create a Time indicator column.

 

Time Indicator Column = 
SWITCH(
    TRUE(),
    'Table'[CC Year]=2020 && 'Table'[Period number]>=1&&'Table'[Period number]<=5,"YTD",
    'Table'[CC Year]=2020 && 'Table'[Period number]>5&&'Table'[Period number]<=13 ,"YTG",
    'Table'[CC Year]=2019,"YTG")

 

P2.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared/

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

3 REPLIES 3
Super User IV
Super User IV

@singh_gagan03 , what is the reason for doing this. Are you looking for time intelligence?

 

If they are stand period refer : https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-1-Time-Intell...

 

If they are non-standard: https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...

 

Creation of calendar :



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Community Support
Community Support

Hi @singh_gagan03 ,

 

If you want to create the Time indicator column, we can use the following steps to meet your requirement.

 

1. Create a Period number column.

 

Period number = CONVERT(RIGHT('Table'[Period],LEN('Table'[Period])-1),INTEGER)

 

P1.jpg

 

2. Then we can create a Time indicator column.

 

Time Indicator Column = 
SWITCH(
    TRUE(),
    'Table'[CC Year]=2020 && 'Table'[Period number]>=1&&'Table'[Period number]<=5,"YTD",
    'Table'[CC Year]=2020 && 'Table'[Period number]>5&&'Table'[Period number]<=13 ,"YTG",
    'Table'[CC Year]=2019,"YTG")

 

P2.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared/

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

Community Support
Community Support

Hi @singh_gagan03 ,

 

How about the result after you follow the suggestions mentioned in my original post?

Could you please provide more details or expected result about it If it doesn't meet your requirement?

If you've fixed the issue on your own please kindly share your solution.

 

Best regards,

 

Community Support Team _ zhenbw

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors