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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Shiji_Menon
Frequent Visitor

How to create summarized new table out o existing one?

From the following table

Shiji_Menon_0-1693043479940.png

I wanted to create the following visual in 'table' in power bi tile.

Shiji_Menon_1-1693043503842.png

 

I tried to create a new table named SummaryTable and following is the query used.

 
SummaryTable =
UNION(
ROW("Activity", "2023", "2022" ),
ROW("Total Passengers",[Psngr_Cnt_2023] ,[Psngr_Cnt_2022] ),
ROW("Total Flight Departed", [Departure_Cnt_2023], [Departure_Cnt_2023])
)

But it was not working and showing error "here there was a error Column '2022' added by the 'ROW' function must have the scalar expression specified."

 

Following are the formulas used

Psngr_Cnt_2022 = CALCULATE(SUM(Table1[Passengers Total]),DATESYTD(ENDOFYEAR(dateadd(Table1[Year ],-1,Year)),"12/31"))
Psngr_Cnt_2023 = CALCULATE(SUM(Table1[Passengers Total]),DATESYTD(ENDOFYEAR(Table1[Year ]),"12/31"))
Departure_Cnt_2022 = CALCULATE(SUM(Table1[Aircraft departures (a) ]),DATESYTD(ENDOFYEAR(dateadd(Table1[Year ],-1,Year)),"12/31"))
Departure_Cnt_2023 = CALCULATE(SUM(Table1[Aircraft departures (a) ]),DATESYTD(ENDOFYEAR(Table1[Year ]),"12/31"))

 

Can you guys help me ?

@amitchandak @parry2k @Ritaf1983 

8 REPLIES 8
parry2k
Super User
Super User

@Shiji_Menon solution is attached, tweak it as you see fit.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Greg_Deckler
Super User
Super User

@Shiji_Menon I would suggest creating measures for each of your KPI's. Then use a matrix visual and the "Switch values to rows" toggle under Values | Values | Options in the format pane for the visual.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

I made an attempt to create the measure. But my lack of knowledge held me back. Could you show me a sample,if its okay? I would really appreciate it.

@Shiji_Menon Could you post data data from your original table as text?


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Year  Month  Month No.Year-MonthHours flown Aircraft km flown ('000)Aircraft departures (a) Total rev pax (TOB) Freight tonnes (TOB) (b) Mail tonnes (TOB) (b) Total RPK ('000) Weight load factor % (b) Total  charter pax (TOB) (d) Charter aircraft departures (d) Aircraft movements Total Flights Inbound to AustraliaFlights Outbound from AustraliaFlights  TotalPassengers  Inbound to AustraliaPassengers  Outbound from AustraliaPassengers   TotalSeat utilisation %  Total44,82,8013,12,82439,87,6003,07,60325,38,7462,39,04424,21,8852,60,052

2023Jan1Jan 202385,40747,19148,9188,5404,09254,51,34967.35,60714,6307,1187,09714,21516,44,11714,10,56730,54,68486.7
2023Feb2Feb 202377,20941,45345,9488,7904,00146,11,11666.85,25512,7346,1946,17012,36414,04,15711,19,97525,24,13281.6
2022Jan1Jan 202258,83231,81136,73212,4642,61427,00,53950.94,8705,9332,6722,6195,2912,58,6261,83,9664,42,59246.2
2022Feb2Feb 202250,12426,43832,22913,7414,06624,60,09260.24,9965,7132,6022,5335,1352,64,1681,72,2854,36,45349.0

Hi,

The data has not been pasted properly so when i try to take it over to an Excel file, it is all meaningless.  Create a Excel file with 2 tabs - Input and Output.  In the Output file, show the exact result you are expecting.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I apologize for the incorrect formatting earlier. Please refer to the table provided below

 

Input :

Year  Month  Month No.Year-MonthHours flown Aircraft km flown ('000)Aircraft departures (a) Total rev pax (TOB) Freight tonnes (TOB) (b) Mail tonnes (TOB) (b) Total RPK ('000) Weight load factor % (b) Total  charter pax (TOB) (d) Charter aircraft departures (d) Aircraft movements Total Flights Inbound to AustraliaFlights Outbound from AustraliaFlights  TotalPassengers  Inbound to AustraliaPassengers  Outbound from AustraliaPassengers   TotalSeat utilisation %  Total
2023Jan2Jan 202385,40747,19148,91844,82,8018,5404,09254,51,34967.33,12,8245,60714,6307,1187,09714,21516,44,11714,10,56730,54,68486.7
2023Feb1Feb 202377,20941,45345,94839,87,6008,7904,00146,11,11666.83,07,6035,25512,7346,1946,17012,36414,04,15711,19,97525,24,13281.6
2022Jan2Jan 202258,83231,81136,73225,38,74612,4642,61427,00,53950.92,39,0444,8705,9332,6722,6195,2912,58,6261,83,9664,42,59246.2
2022Feb3Feb 202250,12426,43832,22924,21,88513,7414,06624,60,09260.22,60,0524,9965,7132,6022,5335,1352,64,1681,72,2854,36,45349.0

 

Output :

AIRLINE OUTPUT SUMMARY20232022% change
Passengers   Total55,78,8168,79,045+534.645097805004
Aircraft movements Total 27,36411,646+134.964794779323
Mail tonnes (TOB) (b) 8,0926,680+21.1451467305795
Freight tonnes (TOB) (b) 17,32926,204--33.8696527698699

Hi,

Will the years shown in the output range be selected via a slicer or will these years always be 2022 and 2023?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.