Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi all, I wanna create a calculate column ex: have two columns, one category and product.
If same category and have product A and b then 1 for category if not then 0 look at screenshot:
| Category | product | Outcome |
| A | A | 1 |
| A | B | 0 |
| A | C | 0 |
| A | D | 0 |
| A | E | 0 |
| A | F | 0 |
| A | G | 0 |
| A | H | 0 |
| B | C | 0 |
| B | D | 0 |
| C | A | 1 |
| C | B | 0 |
| C | C | 0 |
| C | D | 0 |
| C | E | 0 |
thanks
Solved! Go to Solution.
try this measure,
Category Count =
CALCULATE(
DISTINCTCOUNT('Table'[Category]),
'Table'[product] IN {"A","B"})
Try this calculated column
Outcome =
VAR currentCategory = [Category]
VAR hasProductA =
CALCULATE(
COUNTROWS('Table'),
'Table'[Category] = currentCategory,
'Table'[Product] = "A"
) > 0
VAR hasProductB =
CALCULATE(
COUNTROWS('Table'),
'Table'[Category] = currentCategory,
'Table'[Product] = "B"
) > 0
RETURN
IF(hasProductA && hasProductB, 1, 0)
Hi got 0 as outcome
I have made a small modification to the DAX provided by @aduguid . Could you please check if it is working correctly?
Outcome =
VAR hasProductA =
CALCULATE(
COUNTROWS('Table'),
'Table'[Category] = "A",
'Table'[Product] = "A"
)
VAR hasProductB =
CALCULATE(
COUNTROWS('Table'),
'Table'[Category] = "B",
'Table'[Product] = "B"
)
RETURN
IF(hasProductA = 1 || hasProductB = 1 , 1, 0)
Hi, thanks for your support is possible to have as my outcome? i want to sum how many category whos have product a and b.
try this measure,
Category Count =
CALCULATE(
DISTINCTCOUNT('Table'[Category]),
'Table'[product] IN {"A","B"})
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 96 | |
| 70 | |
| 50 | |
| 42 | |
| 40 |