The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
HI! so I am trying to use the isinscopre function in a matrix to show different transaction count values based on the hierarchy of Event Name -> Offer ID -> SKU. My measure works fine to switch teh values betweek sku and offer, but for osme reason it's showing the total sum of ALL events and not just the associated event. I'm wondering if it's something wrong with my model?
Below is the measure
So from left to right, this is my transactions measure, the count for the event, the count for teh offers for that event (one offer in this example), and the count for differnet sku products.
Looking across the rows, it works fine except for that event, which is showing the sum of total counts for all. The event, sku,and offer tables are connected with unique keys, and there are unique values of the event id, so i'm not sure why this isn't calulating correctly. Is there a way to just not use Sum at all in my measure, and have it display the correct associated count? Thanks!
Solved! Go to Solution.
HI @alaynanich,
After using filter to check the current row contents level, you also need to add correspond filters to these expressions to control calculate the result instead directly use aggregate functions(e.g. sum, average, average) to implicit calculation.
TY Transactions =
VAR sku =
CALCULATE (
SUM ( 'Consolidated SKU Sales'[Total transactions] ),
ALLSELECTED ( 'Consolidated SKU Sales' ),
VALUES ( 'Consolidated SKU Sales'[SKU] )
)
VAR offer =
CALCULATE (
SUM ( 'Consolidated Offer'[ty trans count] ),
ALLSELECTED ( 'Consolidated SKU Sales' ),
VALUES ( 'Consolidated SKU Sales'[SKU] ),
VALUES ( 'Consolidated SKU Sales'[Offer Name Tx] )
)
VAR event =
CALCULATE (
SUM ( 'Consolidated Events'[ty trans count] ),
ALLSELECTED ( 'Consolidated SKU Sales' ),
VALUES ( 'Consolidated SKU Sales'[SKU] ),
VALUES ( 'Consolidated SKU Sales'[Offer Name Tx] ),
VALUES ( 'Consolidated SKU Sales'[Event Nm] )
)
RETURN
IF (
ISINSCOPE ( 'Consolidated SKU Sales'[SKU] ),
sku,
IF (
ISINSCOPE ( 'Consolidated SKU Sales'[Offer Name Tx] ),
offer,
IF ( ISINSCOPE ( 'Consolidated SKU Sales'[Event Nm] ), event )
)
)
Regards,
Xiaoxin Sheng
@Anonymous thank you!! that worked like a charm!
HI @alaynanich,
After using filter to check the current row contents level, you also need to add correspond filters to these expressions to control calculate the result instead directly use aggregate functions(e.g. sum, average, average) to implicit calculation.
TY Transactions =
VAR sku =
CALCULATE (
SUM ( 'Consolidated SKU Sales'[Total transactions] ),
ALLSELECTED ( 'Consolidated SKU Sales' ),
VALUES ( 'Consolidated SKU Sales'[SKU] )
)
VAR offer =
CALCULATE (
SUM ( 'Consolidated Offer'[ty trans count] ),
ALLSELECTED ( 'Consolidated SKU Sales' ),
VALUES ( 'Consolidated SKU Sales'[SKU] ),
VALUES ( 'Consolidated SKU Sales'[Offer Name Tx] )
)
VAR event =
CALCULATE (
SUM ( 'Consolidated Events'[ty trans count] ),
ALLSELECTED ( 'Consolidated SKU Sales' ),
VALUES ( 'Consolidated SKU Sales'[SKU] ),
VALUES ( 'Consolidated SKU Sales'[Offer Name Tx] ),
VALUES ( 'Consolidated SKU Sales'[Event Nm] )
)
RETURN
IF (
ISINSCOPE ( 'Consolidated SKU Sales'[SKU] ),
sku,
IF (
ISINSCOPE ( 'Consolidated SKU Sales'[Offer Name Tx] ),
offer,
IF ( ISINSCOPE ( 'Consolidated SKU Sales'[Event Nm] ), event )
)
)
Regards,
Xiaoxin Sheng
User | Count |
---|---|
24 | |
10 | |
8 | |
7 | |
6 |
User | Count |
---|---|
32 | |
12 | |
10 | |
10 | |
9 |