Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello
On the Contoso model I have a simple measure that calculate the amount of red product:
Red Sales = CALCULATE(
[Amount],
'Product'[Color] = "Red"
)
I want to create a measure that shows the Amount where the [Red Sales] is not blank without manually filtering the visual.
Below the expected result with filter on the visual :
Solved! Go to Solution.
@SniperPro86
Please try
MeasureTest3 =
SUMX (
FILTER (
VALUES ( Customer[Name] ),
[Red Sales] <> BLANK ()
),
[Amount]
)
Or
MeasureTest4 =
SUMX (
SUMMARIZE (
FILTER (
Sales,
RELATED ( 'Product'[Color] ) = "Red"
),
Customer[Name]
),
[Amount]
)
Hi @SniperPro86
please try
Red Sales =
CALCULATE ( [Amount], KEEPFILTERS ( 'Product'[Color] = "Red" ) )
Hi @tamerj1
I don't want to calculate just the Amount of red product.
I want all the sales amount of the current context but just show the rows where there is a sales of a red product.
For exemple, I want all sales amount of customers who purchased at least one red product.
or all sales amount by years but just show the years where at least one sales of a red product happened.
I don't know if the requirement is clear.
@SniperPro86
Please try
MeasureTest3 =
SUMX (
FILTER (
VALUES ( Customer[Name] ),
[Red Sales] <> BLANK ()
),
[Amount]
)
Or
MeasureTest4 =
SUMX (
SUMMARIZE (
FILTER (
Sales,
RELATED ( 'Product'[Color] ) = "Red"
),
Customer[Name]
),
[Amount]
)
hi @SniperPro86
try like:
Hello @FreemanZ
This is not working.
I wrote the measure below:
Measure Test 2 =
var CustomerR = FILTER(VALUES(Customer[Name]), [Red Sales] <> 0)
Return
CALCULATE(
[Amount],
Customer[Name] in CustomerR
)
It is working fine when I do analyse by customer Name but give a wrong result when I analyse by date for exemple.
User | Count |
---|---|
25 | |
11 | |
8 | |
7 | |
6 |
User | Count |
---|---|
25 | |
13 | |
12 | |
10 | |
6 |