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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Create a measures table

Hi,

 

I have some measures that I show in a table

This is my table tablepower.PNG

 

I want something like this but I don't found how to do this

 RVLV
Average  
SD  
Min  
Max  

 

 

Thanks !

2 ACCEPTED SOLUTIONS
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

I create a sample file for your reference.

Create measures:

Average = SWITCH(SELECTEDVALUE(MeasureType[Type]),"LV",[Average LV Flow],"RV",[Average RV Flow])

SD = SWITCH(SELECTEDVALUE(MeasureType[Type]),"LV",[SD LV Flow],"RV",[SD RV Flow])

......

071504.jpg

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

View solution in original post

Hi @Anonymous 

 

Actually it doesn't matter which table the measures are located in. They always work the same. The thing you need to do is to create a new table like below. You can use Enter data to enter RV and LV values in a column. You can name the column header as you like.

072305.jpg

Then create measures like below. The purpose of this measure is to decide when the type is LV, then return the result of [ ... LV ... ] measure otherwise return [... RV ...] measure's result.

Average = SWITCH(SELECTEDVALUE(MeasureType[Type]),"LV",[Average LV Flow],"RV",[Average RV Flow])

 

Jing

View solution in original post

9 REPLIES 9
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

I create a sample file for your reference.

Create measures:

Average = SWITCH(SELECTEDVALUE(MeasureType[Type]),"LV",[Average LV Flow],"RV",[Average RV Flow])

SD = SWITCH(SELECTEDVALUE(MeasureType[Type]),"LV",[SD LV Flow],"RV",[SD RV Flow])

......

071504.jpg

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

Anonymous
Not applicable

Hi, thanks for your answer

 

But I have an error with "MeasureType[Type]"

 

 

I don't know what it is and how to apply it to my data... 
 
 

Hi @Anonymous 

 

In my model, "MeasureType" is a table which contains a column named "Type". In the column "Type", it contains values "LV" and "RV". You can download the sample pbix in my previous post to see the details.

 

You can use Enter Data to create a table similar to "MeasureType" easily. Then create measures similar to mine. Note that in your measures, you need to use your table and column names rather than just copying my table and column names, otherwise you will have an error like "cannot find table.../column..."

 

Regards,

Jing

Anonymous
Not applicable

Hi @v-jingzhang 

In my case it's in the Stat table however it's not a column but a measure like you can see on the screen 

powerbi.PNG

 

So "Measure Type" corresponds to "Stat" in my case but "Type" I don't know...
 
Thanks for you help !

Hi @Anonymous 

 

Actually it doesn't matter which table the measures are located in. They always work the same. The thing you need to do is to create a new table like below. You can use Enter data to enter RV and LV values in a column. You can name the column header as you like.

072305.jpg

Then create measures like below. The purpose of this measure is to decide when the type is LV, then return the result of [ ... LV ... ] measure otherwise return [... RV ...] measure's result.

Average = SWITCH(SELECTEDVALUE(MeasureType[Type]),"LV",[Average LV Flow],"RV",[Average RV Flow])

 

Jing

Anonymous
Not applicable

Ok it works, thanks a lot for the help and explanations ! 🙂

AllisonKennedy
Super User
Super User

You'll need to create a new table with a column that has values "RV" and "LV" in it. Add that to a Matrix visual in 'Columns'. Let's call that table Metric and the column V

 

Then you can add measures to the Values of the Matrix and set the Format property of Values to 'show on rows' to On (it's off in this screenshot): 

AllisonKennedy_0-1626166321835.png

 

For the measures to add, follow a pattern such as this: 

 

Average = 
SWITCH( SELECTEDVALUE(Metric[V])
, "RV", [Average RV Flow]

, "LV", [Average LV Flow]
)

 

SD = 
SWITCH( SELECTEDVALUE(Metric[V])
, "RV", [SD RV Flow]

, "LV", [SD LV Flow]
)

 

etc...

 

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Thanks for your answer

I have created my new table with RV and LV columns wich are empty

But I failed to insert my measures(from an another table named "STAT") into this tableempty.PNGstatmeasures.PNG

@Anonymous  as v-jingzhang stated it won't matter which table your measures are in. Use the formula I provided or he provided: 

 

Average = SWITCH(SELECTEDVALUE(FlowTable[Type]),"LV",[Average LV Flow],"RV",[Average RV Flow])

SD = SWITCH(SELECTEDVALUE(FlowTable[Type]),"LV",[SD LV Flow],"RV",[SD RV Flow])

You have two columns for each type, but only need one column for Type and then use that in a matrix to turn it into columns.  


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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