Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi
So i have trouble to create logic to solve package issue.
the goal is to put remark when customer buy our package which consist of several products
if customer didn't buy the specific product then we remark it as 0, if buy all of the specific products then we remark it as 1
Here's my DAX logic
Well in excel i could easily do COUNT IF cell value >= 1.5 is equal to 6 then 1 , if false 0. then sum it.
but i cannot do that easily in power BI. still learning to be better.
Thank you
Solved! Go to Solution.
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
)
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
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 @Fxelixe
please try
Package Remark =
VAR Count1 =
COUNTROWS (
FILTER (
VALUES ( 'Product'[Product Name] ),
'Product'[Product Name]
IN { "Product A", "Product B", "Product C", "Product D" }
)
)
RETURN
IF ( ISINSCOPE ( 'Product'[Product Name] ), Count1, IF ( Count1 = 4, 1 ) )
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
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
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.
Thank you so much for helping me getting be better on dax. really appreciate it
yes i also think the same idea hahaha. thank you, i hope in the future someone will be helped by this thread
hi @Fxelixe
IN is OR logic, but it seems you expect a AND logic. Try to modify it firstly.
If the issue persists, it would be necessary to also provide more info about your data model: tables, columns and relationships. It seems you have at least a Product Table and Fact Table, maybe a Customer Table as well.
yes I already think to use AND, but AND logic only works for 2 item. I need flexibilities to determine # of products
you can use && to combine Boolean expressions as many as possible.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 22 | |
| 10 | |
| 10 | |
| 7 | |
| 5 |