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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
fallengoose
New Member

Make the field in a measure change to the field selected

Hi I am new to Power BI and I am just getting my head in it so I apologise in advance if this is a silly question.  I have created 4 measures (one counts the number of 1s in a column, measure 2 counts the number of 2s etc and it carries on until number 4 eg Measure 1 = CALCULATE(countrows(table1),table1[col1]="1"). The aim is to show a stacked percentage chart. In the measure the field is hard coded as Col 1.  Is there anyway of to change this so that uses the field selected or am I getting the whole idea confused?

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

@fallengoose

 

To count number of rows dynamically based on your selected fields, you can use ALLSELECTED() function without specifying columns. It will determine your selection to filter the table.

 

6.PNG

 

77.PNG

 

888.PNG

 

For better understanding of ALLSELECTED(), please see: Understanding ALLSELECTED

 

Regards,

View solution in original post

1 REPLY 1
v-sihou-msft
Microsoft Employee
Microsoft Employee

@fallengoose

 

To count number of rows dynamically based on your selected fields, you can use ALLSELECTED() function without specifying columns. It will determine your selection to filter the table.

 

6.PNG

 

77.PNG

 

888.PNG

 

For better understanding of ALLSELECTED(), please see: Understanding ALLSELECTED

 

Regards,

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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