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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
davidiraz
New Member

need help

hi everyone. i need to develop a dashboard from a sql server and i have a little problem with the data order in one of the table.

 

1 - i have a table that contain a budget data. the table look like this:

BUDGET NAMEYEARJANFEBMARCHAPRIL
ABC12345620191000150020003000

 

and its continue to the next year...

2. i need to create a comparing dashboard between the budget and invoices table that look like this:

INOIVE NUMBERBUDGET NAMEINVOICE DATETOTAL $CURRENCY
123ABC12345601/01/20191500US DOLLAR
456ABC12345601/02/20192000US DOLLAR
789ABC12345601/03/20295000US DOLLAR

 

the desired result need to be that the user will be able to choose invoices dates, for example between 01/01/2019

and 31/03/2019

and i need to show somthing like:

INOIVE NUMBERBUDGET NAMEINVOICE DATETOTAL $BUDGETDELTACURRENCY
123ABC12345601/01/201915001000-500US DOLLAR
456ABC12345601/02/201920001500-500US DOLLAR
789ABC12345601/03/20295000200-4800US DOLLAR

 

how can i do it?

thanks.😀

1 ACCEPTED SOLUTION
vivran22
Community Champion
Community Champion

Hello @davidiraz 

 

Unpivot option is available in Power Query.

 

For your budget table, select Budget Name & Year > right click on the and Select Unpivot Other Columns

 

vivran22_2-1598758508531.png

 

 

Select Month & Year column and Merge with a space:

vivran22_3-1598758597646.png

 

Transform the Month column as Date:

vivran22_4-1598758651823.png

 

The output:

vivran22_5-1598758680251.png

 

Hope this helps!

 

Cheers!
Vivek

Blog: vivran.in/my-blog
Connect on LinkedIn
Follow on Twitter

 

 

View solution in original post

4 REPLIES 4
vivran22
Community Champion
Community Champion

Hello @davidiraz 

 

Unpivot option is available in Power Query.

 

For your budget table, select Budget Name & Year > right click on the and Select Unpivot Other Columns

 

vivran22_2-1598758508531.png

 

 

Select Month & Year column and Merge with a space:

vivran22_3-1598758597646.png

 

Transform the Month column as Date:

vivran22_4-1598758651823.png

 

The output:

vivran22_5-1598758680251.png

 

Hope this helps!

 

Cheers!
Vivek

Blog: vivran.in/my-blog
Connect on LinkedIn
Follow on Twitter

 

 

thanks you very much!!!

Greg_Deckler
Community Champion
Community Champion

@davidiraz Not sure that I entirely follow, but you will almost certainly want to start by unpivoting your month columns:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnRyNjQyNjE1U9JRMjIwtARShgYGBiDKFEwZQXjGICo2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"BUDGET NAME" = _t, YEAR = _t, JAN = _t, FEB = _t, MARCH = _t, APRIL = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"BUDGET NAME", type text}, {"YEAR", Int64.Type}, {"JAN", Int64.Type}, {"FEB", Int64.Type}, {"MARCH", Int64.Type}, {"APRIL", Int64.Type}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"BUDGET NAME", "YEAR"}, "Attribute", "Value")
in
    #"Unpivoted Columns"


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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

where do i need to put this code?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.