Forum Discussion
Re:
- 3 years ago
Hi,
I am not sure how your datamodel looks like, but please check the below picture and the attached pbix file.
It is for creating a measure.
I hope the below can provide some ideas on how to create a solution for your datamodel.
Expected output: = VAR _productAcondition = CALCULATE ( SUM ( Data[Quantity] ), Package[Product Name] = "Product A" ) <> 0 VAR _productBcondition = CALCULATE ( SUM ( Data[Quantity] ), Package[Product Name] = "Product B" ) <> 0 VAR _productCcondition = CALCULATE ( SUM ( Data[Quantity] ), Package[Product Name] = "Product C" ) <> 0 VAR _productDcondition = CALCULATE ( SUM ( Data[Quantity] ), Package[Product Name] = "Product D" ) <> 0 RETURN IF ( HASONEVALUE ( User[User] ), _productAcondition * _productBcondition * _productCcondition * _productDcondition ) - 3 years ago
Update:
Already have the answer but kinda complicated.
the idea is to create multiple var to count the products
and then return it using floor
return
floor(item(1)+item(2)+....+Item(n),n)/n - 3 years ago
Hi,
Thank you for your message, and please check the below picture and the attached pbix file.
I tried to create a sample pbix file like below.
Hi,
I am not sure how your datamodel looks like, but please check the below picture and the attached pbix file.
It is for creating a measure.
I hope the below can provide some ideas on how to create a solution for your datamodel.
Expected output: =
VAR _productAcondition =
CALCULATE ( SUM ( Data[Quantity] ), Package[Product Name] = "Product A" ) <> 0
VAR _productBcondition =
CALCULATE ( SUM ( Data[Quantity] ), Package[Product Name] = "Product B" ) <> 0
VAR _productCcondition =
CALCULATE ( SUM ( Data[Quantity] ), Package[Product Name] = "Product C" ) <> 0
VAR _productDcondition =
CALCULATE ( SUM ( Data[Quantity] ), Package[Product Name] = "Product D" ) <> 0
RETURN
IF (
HASONEVALUE ( User[User] ),
_productAcondition * _productBcondition * _productCcondition * _productDcondition
)
Hi Jihwan_Kim ,
your dax works and helps me a lot!, but suddenly the problem got more complex for me:
1. package is valid if each product's sold is >= 1.5
2. the result can be cumulative on the last solution it would be total = 2
(my hypothesis because if we use IF statement, the calculation will treat them as logical, not cumulative)
3. each user has one group and the result expected to be summarize by group
Here's the updated table
and then if grouped by "Group"
thank you so much
- Jihwan_Kim3 years agoSuper User
Hi,
Thank you for your message, and please check the below picture and the attached pbix file.
I tried to create a sample pbix file like below.
- Fxelixe3 years agoFrequent Visitor
Thank you so much for helping me getting be better on dax. really appreciate it