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
UsePowerBI
Post Prodigy
Post Prodigy

How to specify a different measure in the same field of a table?

Hello

 

I want to create a visual with the table:

 

Check1; CheckType1; Result1

Check1; CheckType2; Result2

 

The Check1, CheckType1, etc are simply text.

 

The Result1, Result2 are measures such as the percentage of empty rows in a different table and the percentage of numeric values in a field in another table.

 

How do I structure my data to create the above output?

 

Thanks!

1 ACCEPTED SOLUTION

Hi, @UsePowerBI 

9.png

Try  the measure as below: 

 

Measure 4 = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Table 3'[Measure] ) = "3", [Measure 3],
    SELECTEDVALUE ( 'Table 3'[Measure] ) = "2",[Measure 2],
    SELECTEDVALUE('Table 3'[Measure])="1",[Measure 1]   
)

 

(the type of  the field "measure" is text rather than whole number 

BTW ,I'm not clear why you cannot open my  file.

You may refer to this thread or  update the version  of powerbi desktop to the latest.

https://community.powerbi.com/t5/Desktop/object-reference-not-set-to-an-instance-of-an-object-while/...

 

Best Regards,
Community Support Team _ Eason

View solution in original post

6 REPLIES 6
v-easonf-msft
Community Support
Community Support

Hi, @UsePowerBI

Did not fully understand what you meant?

Can you use specific tables and data to show the results you want?

 

You may check if the following mesures help.

Measure 1 = 
IF (
    SELECTEDVALUE ( 'Table'[Column1] ) = "Check1"
        && SELECTEDVALUE ( 'Table'[Column2] ) = "CheckType1",
    your_measure1,
    IF (
        SELECTEDVALUE ( 'Table'[Column1] ) = "Check1"
            && SELECTEDVALUE ( 'Table'[Column2] ) = "CheckType2",
        your_measure2
    )
)

or 

Measure2 = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Table'[Column1] ) = "Check1"
        && SELECTEDVALUE ( 'Table'[Column2] ) = "CheckType1", your_measure1,
    SELECTEDVALUE ( 'Table'[Column1] ) = "Check1"
        && SELECTEDVALUE ( 'Table'[Column2] ) = "CheckType2", your_measure2
)



Here is a sample.

pbix attached

 

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

I cannot open your file unfortunately:
Object reference not set to an instance of an object.

 

Also, how am I supposed to use your Measure 1?

I created a table visual, I dragged the Column Check1 and then I dragged the Measure 1 but it breaks.

I think the SELECTEDVALUE is not an applicable function. The code should check the value in Table1[Column1] and display the right calculation next to each value.

 

Any idea?

Hi, @UsePowerBI 

9.png

Try  the measure as below: 

 

Measure 4 = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Table 3'[Measure] ) = "3", [Measure 3],
    SELECTEDVALUE ( 'Table 3'[Measure] ) = "2",[Measure 2],
    SELECTEDVALUE('Table 3'[Measure])="1",[Measure 1]   
)

 

(the type of  the field "measure" is text rather than whole number 

BTW ,I'm not clear why you cannot open my  file.

You may refer to this thread or  update the version  of powerbi desktop to the latest.

https://community.powerbi.com/t5/Desktop/object-reference-not-set-to-an-instance-of-an-object-while/...

 

Best Regards,
Community Support Team _ Eason

Hello, it's a bit complicated.

 

I have two tables.

 

Table1=

Country, Sales

US, 2

DE, 3

UK, 1

 

Table2=

Owner, Code Number

John, A1

George, A1

James, A2

 

I want to create a table that combines Table2 plus specific Measures in a third column, i.e. like this:

 

Table3=

Owner, Code Number, Measure

John, A1, 2

George, A1, 3

George, A2, 1

 

The percentages above are calculated by Measures based on Table1, e.g.

2 = AVERAGE([Table1[Sales])

3 = MAX([Table1[Sales])

1 = MIN([Table1[Sales])

 

Any idea?

amitchandak
Super User
Super User

@UsePowerBI , with common dimensions you case use option show on row in a matrix

https://www.burningsuit.co.uk/blog/2019/04/7-secrets-of-the-matrix-visual/

 

Or you can use union and summarize to create the table in structure you want

Thanks but it's not clear which steps I should take, can you explain please?

What structure my source table should have and how do I get the output I want?

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.