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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
s15
Helper III
Helper III

Best practices for pivoting dimension

Hi all,

 

I have a dataset named financial data which comprises of list of products, sales, segment and country or so on (see the screen below)

 

finance.PNG

 

Now I need to see which product, segment and country by year 2013 and 2014 to compare. What I did was to duplicate the financial table then remove uneccessary columns. That said, there are three duplicated tables

  • sales_product_by_year: consists of product, sales and year column
  • sales_segment_by_year: consists of segment, sales and year column
  • sales_country_by_year: consists of country, sales and year column

table.PNG

 

I then pivoted each of the three above tables

 

 chart.PNG

 

I think I have completed the work and these charts meet my expectation. However I'm not sure if this is a practice to do for pivoting. Everytime if you need to pivot a dimension, do you have to create a specific table. Is there a way to combine all of three tables in my case into a table and use Dax to query?

Your suggestion is always appreciated.

 

 

1 ACCEPTED SOLUTION
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @s15,

 

Yes, we need one table and two measures in this scenario. I believe there are also other ways.

I sampled a table from yours. And the two measures are:

 

Sales2013 =
CALCULATE ( SUM ( 'Financials'[Sales] ), 'Financials'[Year] = 2013 )
Sales2014 =
CALCULATE ( SUM ( Financials[Sales] ), 'Financials'[Year] = 2014 )

Best practices for pivoting dimension.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

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

4 REPLIES 4
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @s15,

 

Yes, we need one table and two measures in this scenario. I believe there are also other ways.

I sampled a table from yours. And the two measures are:

 

Sales2013 =
CALCULATE ( SUM ( 'Financials'[Sales] ), 'Financials'[Year] = 2013 )
Sales2014 =
CALCULATE ( SUM ( Financials[Sales] ), 'Financials'[Year] = 2014 )

Best practices for pivoting dimension.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

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

Thank you very much for your support @v-jiascu-msft 

 

Measure is really useful and it reduces my effort to duplicate my table. However, if I want to add 2013 and 2014 to my slicer chart, measure does not help right? In this case I would still need to duplicate my table and remove unnecessary column.

 

Hi @s15,

 

Measure can't be added in the slicer visual by now. Do you mean it as the picture shows? Or you could post it here. Maybe we could find out a workaround.

BTW, I am going to update the two measures, which will be more accurate.

 

Sales2013 =
CALCULATE (
    SUM ( 'Financials'[Sales] ),
    FILTER ( 'Financials', 'Financials'[Year] = 2013 )
)
Sales2014 =
CALCULATE (
    SUM ( Financials[Sales] ),
    FILTER ( 'Financials', 'Financials'[Year] = 2014 )
)

Best practices for pivoting dimension2.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

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

Hi @v-jiascu-msft

 

That's correct. I want to extract two value of year (2013 and 2014) from the Years to add to slicer chart. That's one of the reason why the question came out.

 

Thank you.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors