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 Team,
I want your help in writing a dax query. My requirement is given below -
My data
segement | sales | manufacturer |
midsize uv | 100 | A |
midsize uv | 200 | B |
premium full size | 400 | B |
expected sum 300 since ONLY midsize uv is the part of A |
I want to find out the sum of sales for all those segments where manufacturer is equals to A e.g midsize UV is the part of A manufacturer so total sum of sales would be 100 +200 = 300. premium full size is not part of A so it is ignored
Solved! Go to Solution.
@SagarJagga ,Please try this formula
Proud to be a Super User! |
|
@SagarJagga ,Please try this formula
Proud to be a Super User! |
|
Hi Gautam,
Getting an error "A table of multiple values was supplied where a single value was expected"
@SagarJagga , You can create a measure for this
SumOfSalesForA =
CALCULATE (
SUM ( YourTable[sales] ),
FILTER (
YourTable,
YourTable[segment] IN {
SELECTCOLUMNS (
FILTER (
YourTable,
YourTable[manufacturer] = "A"
),
"segment", YourTable[segment]
)
}
)
)
Proud to be a Super User! |
|
Thanks for your help, just wanted to know why selectColumn has not worked.
Much appreciated
Hi Gautam,
Actually we have multiple segments which are coming under manufacturer A. so it is throwing an error "A table of multiple values was supplied where a single value was expected"
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
13 | |
13 | |
8 | |
8 |