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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Bond700
Frequent Visitor

insert measure in row in power bi

I need help. There is a pivot table in which in the rows - Companies, in the columns - Months, and in the values ​​- Measure, which defines the segment of companies for each month.
now.PNG
I want to change the pivot table this way: in the rows - Measure, in the columns - Months, and in the values ​​- share of companies in each segment every month.

123.PNG
Excel in the WinRar file,. I will be grateful for help
Do you understand the question or need clarification?

1 ACCEPTED SOLUTION
lc_finance
Solution Sage
Solution Sage

Hi @Bond700 ,

 

 

you can download my proposed solution from here.

 

The solution is to:

1) Generate a new table by segment and by month. Here is the DAX code for it:

Segments by month = GENERATE(segments, VALUES('Calendar'[Date].[Month]))

 

2) Create a measure that will count the % companies in the segment 'new', in the segment 'Top', etc.

Here is the DAX code for it:

% by segment = 

SWITCH(SELECTEDVALUE('Segments by month'[Segment]),
"business", SUMX(VALUES('companies'[name]), IF([Measure]="business",1,0) )
, "new", SUMX(VALUES('companies'[name]), IF([Measure]="new",1,0) )
, "Top", SUMX(VALUES('companies'[name]), IF([Measure]="Top",1,0) )
, "Sleep", SUMX(VALUES('companies'[name]), IF([Measure]="Sleep",1,0) )
) 

/
SUMX(VALUES('companies'[name]),IF(NOT [Measure]=BLANK(),1,0))

 

And this is what it looks like in Power BI:

insert measures in row Power BI

Does this help you?

 

Do not hesitate if you have further questions,

 

LC

Interested in Power BI and DAX templates? Check out my blog at www.finance-bi.com

 

View solution in original post

1 REPLY 1
lc_finance
Solution Sage
Solution Sage

Hi @Bond700 ,

 

 

you can download my proposed solution from here.

 

The solution is to:

1) Generate a new table by segment and by month. Here is the DAX code for it:

Segments by month = GENERATE(segments, VALUES('Calendar'[Date].[Month]))

 

2) Create a measure that will count the % companies in the segment 'new', in the segment 'Top', etc.

Here is the DAX code for it:

% by segment = 

SWITCH(SELECTEDVALUE('Segments by month'[Segment]),
"business", SUMX(VALUES('companies'[name]), IF([Measure]="business",1,0) )
, "new", SUMX(VALUES('companies'[name]), IF([Measure]="new",1,0) )
, "Top", SUMX(VALUES('companies'[name]), IF([Measure]="Top",1,0) )
, "Sleep", SUMX(VALUES('companies'[name]), IF([Measure]="Sleep",1,0) )
) 

/
SUMX(VALUES('companies'[name]),IF(NOT [Measure]=BLANK(),1,0))

 

And this is what it looks like in Power BI:

insert measures in row Power BI

Does this help you?

 

Do not hesitate if you have further questions,

 

LC

Interested in Power BI and DAX templates? Check out my blog at www.finance-bi.com

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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