aruydzi
aruydzi

Reputation: 97

Power BI: Override the slicer value in Measure

I have a table which includes products, where each products can have different attributes and prices. Such as this:

Product Attribute 1 Attribute 2 Price
A 10 10000 20$
B 10 10000 15$
C 10 10000 23$
A 20 10000 30$
B 20 10000 32$
C 20 10000 33$
A 10 20000 34$
B 10 20000 44$
C 10 20000 55$
A 30 10000 100$
B 30 10000 222$
C 30 10000 230$

In the Power BI report, there is one slicer for Attribute 1 and one slicer for Attribute 2, both allow single select. The user selects a combination of the attributes (1 from each) and the 3 products are shown with their prices.

Let's consider Attribute 1 = 10 and Attribute 2 = 10000 in the slicers, therefore products A, B, C are showing in the table with their relative prices.

I have a measure which calculates an Alternative Attribute 1. Would it be possible to show an "Alternate Price" in the same table, which uses the Alternative Attribute 1 as the slicer, and get's the equivalent price for Product A, B and C, keeping Attribute 2 slicer same as selected by the user.

Let's say the calculated Aternative Attribute 1 was 20, then, I would like to show the Alternative prices next to the prices for each product (with the user selected filter) using Attribute 1 = 20 but and Attribute 2 same as selected by the slicer.

Many thanks.

Upvotes: 1

Views: 947

Answers (1)

smpa01
smpa01

Reputation: 4282

Are you looking for this?

_measureWithAlternativeAttribute1 =
VAR _1 =
    MAX ( 'Table 1'[Product] )
VAR _2 =
    CALCULATE (
        MAX ( 'Table 1'[Price] ),
        FILTER (
            ALL ( 'Table 1' ),
            'Table 1'[Attribute 1] = [Alternative Attribute 1]
                && 'Table 1'[Product] = _1
        )
    )
RETURN
    _2

Solution

Upvotes: 1

Related Questions