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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
bitofanewb
Frequent Visitor

How can I recreate an Excel 'table' using columns and measures without the data in rows?

Hi,

 

I've been asked to recreate lots of Excel tables (not actual tables, unsure how else to describe them) using Power BI. I've already created hundreds of count columns in Excel Power Query (all rows are either 1 or 0) before pulling the data into Power BI to help with this. The column names are the name of what the row should actually be, plus the month they're counting (i.e. Starts Apr, Prev Yr Starts Apr, FiL Apr, Prev Yr FiL Apr and so on). What I need is to be able to use these columns as rows, and have the months as columns. I need to also create the following rows, which I've done for FiL Apr to show the required calculations: Performance vs Budget (

CALCULATE(SUM('Board Pack'[FiL Apr]) - CALCULATE(SUM(Bud_Other[Apr-24]), Bud_Other[Budget Type] = "Funded in Learning", Bud_Other[Area] = "Total"))
), % Variance to Budget (CALCULATE((SUM('Board Pack'[FiL Apr]) / CALCULATE(SUM(Bud_Other[Apr-24]), Bud_Other[Budget Type] = "Funded in Learning", Bud_Other[Area] = "Total")) -1)
), and RAG Status (
     SWITCH(
        TRUE,
        [FiL Apr % Variance to Budget] >0, "Green",
        [FiL Apr % Variance to Budget] <= -0.1, "Amber",
        "Red"))
).

The budget data comes from a separate query, which is just the data needed pasted into a table (not an actual table), it is already in the rows as needed, the columns are named Apr-24, May-24 and so on (can easily be renamed if that would help).

This is what the 'tables' I need to recreate look like on a basic level: 
bitofanewb_1-1742550809806.png

 

Any help or suggestions on how I could tackle this would be greatly appreciated.

 

Thanks in advance for reading.



1 ACCEPTED SOLUTION

Hi, 

Thanks for the quick reply.

Unfortunately I can't pivot the columns as they are as there's 14.5k rows of data.

I'm going to try creating a table using lookup values with the months as columns, and the rows selecting the correct value for the applicable month. I can adjust the DAX I create for Apr to return the applicable month too.

View solution in original post

2 REPLIES 2
bhanu_gautam
Super User
Super User

@bitofanewb 

Unpivot Columns in Power Query:

Load your data into Power BI.
In Power Query Editor, select the columns that represent the months (e.g., Apr, May, Jun, etc.).
Right-click and choose "Unpivot Columns". This will transform your data so that the months become rows.

 

Create the necessary measures for your calculations

DAX
Performance vs Budget =
CALCULATE(
SUM('Board Pack'[FiL Apr]) -
CALCULATE(
SUM(Bud_Other[Apr-24]),
Bud_Other[Budget Type] = "Funded in Learning",
Bud_Other[Area] = "Total"
)
)

 

DAX
% Variance to Budget =
CALCULATE(
(SUM('Board Pack'[FiL Apr]) /
CALCULATE(
SUM(Bud_Other[Apr-24]),
Bud_Other[Budget Type] = "Funded in Learning",
Bud_Other[Area] = "Total"
)) - 1
)

 

DAX
RAG Status =
SWITCH(
TRUE,
[% Variance to Budget] > 0, "Green",
[% Variance to Budget] <= -0.1, "Amber",
"Red"
)

 

Add a new matrix visualization to your report.
Drag the necessary fields to the Rows, Columns, and Values areas of the matrix.
For example, you can drag the unpivoted month column to Columns, the measure names (Actual, Budget, Prev Yr, etc.) to Rows, and the corresponding values to Values.

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi, 

Thanks for the quick reply.

Unfortunately I can't pivot the columns as they are as there's 14.5k rows of data.

I'm going to try creating a table using lookup values with the months as columns, and the rows selecting the correct value for the applicable month. I can adjust the DAX I create for Apr to return the applicable month too.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.