Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
I am trying to calcuate orders that only have 1 item on them.
I have written
Any one help?
Solved! Go to Solution.
Thank you every one. In the end I created a table using summerize and joined that in the model to the sales fact table with filter direction of both. This returnes the expected result.
Thank you every one. In the end I created a table using summerize and joined that in the model to the sales fact table with filter direction of both. This returnes the expected result.
Be careful on bidirectional filtering, it can create ambiguity if you have more than one fact table.
I suggest to replace the direction to single and inject a call to CROSSFILTER in a calculate statement, so you can setup that relationship as bidirectional ONLY for the time of the calculation and not always.
If you want help on that, send me a direct message and then we post the solution here
If this helped, please consider giving kudos and mark as a solution
@me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
Hi @Si_7777 ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you @Praful_Potphode @FBergamaschi @amitchandak for the prompt response.
I wanted to check if you had the opportunity to review the information provided and resolve the issue..?Please let us know if you need any further assistance.We are happy to help.
Thank you.
Hi @Si_7777
try below measure and let me know if it works.
SalesInCount_Single_Cat =
VAR TransactionCounts =
SUMMARIZE(
ALL(DW_SalesIn),
DW_SalesIn[TransactionId],
"ProductCount",
CALCULATE(
DISTINCTCOUNT(DW_SalesIn[ProductId]),
ALL(DimCategory),
ALL(DimProduct),
DimCategory[CategoryKey] <> 416
)
)
VAR SingleItemTransactions =
FILTER(TransactionCounts, [ProductCount] = 1)
RETURN
CALCULATE(
DISTINCTCOUNT(DW_SalesIn[TransactionId]),
TREATAS(
SELECTCOLUMNS(SingleItemTransactions, "TID", [TransactionId]),
DW_SalesIn[TransactionId]
)
)
Please give kudos or mark it as solution once confirmed.
Thanks and Regards,
praful
Wow thank you it did return values which seemed correct but some categories I could not verify
Hi @Si_7777,
first thing you should never create a column inside SUMMARIZE but used ADDCOLUMNS to do this, second you do not need SUMMARIZE to group a single cloumn, you can use VALUES, finally you can simplify the CALCULATE call so first change is
SUMX (
FILTER (
ADDCOLUMNS (
VALUES ( DW_SalesIn[TransactionId] ),
"PCount",
CALCULATE (
DISTINCTCOUNT ( DW_SalesIn[ProductId] ),
KEEPFILTERS ( DimCategory[DeptKey] <> 416 )
)
),
[PCount] = 1
),
[PCount]
)
Try this code and please let me know, we might have to modifiy that a bit more but meanwhile can you show us the model so we can understand where Category comes from?
If this helped, please consider giving kudos and mark as a solution
@me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
Thank you for your response, very interesting.
The Add column method works the same as using summerize and produces the same result at order type and Im sure performance may be better.
Order 91 is only 1 product
But this still doesnt work for across categories. My model is Sales>Product>Category.
Thanks but to help you in perfect way I would need to have the model visibile or have a sample data
What I can try is suggest this variation but again I am blind without the model
SUMX (
FILTER (
ADDCOLUMNS (
SUMMARIZE (
DW_SalesIn,
DW_SalesIn[TransactionId],
Category[CategoryName]
),
"PCount",
CALCULATE (
DISTINCTCOUNT ( DW_SalesIn[ProductId] ),
KEEPFILTERS ( DimCategory[DeptKey] <> 416 )
)
),
[PCount] = 1
),
[PCount]
)
If this helped, please consider giving kudos and mark as a solution
@me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
Thanks for your help, unfortunately I can't share any data. The tables in question are modelled as below.
So the DAX still does not work?
In case not, I would like to complete the thing as it down not look like anything complex
Can we complete these task connecting online and you show me the issue?
My mail
francesco.bergamaschi@kubisco.com
If you want to settle a timing
best
FB
If this helped, please consider giving kudos and mark as a solution
@me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
Thank you very kind offer.
@Si_7777 , In Such cases, if you add an additional dimension, you have to add the same in Summarize. Usually, Distinctcount ay like level and GT will not match unless you have a common granular group by
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 50 | |
| 40 | |
| 37 | |
| 14 | |
| 14 |
| User | Count |
|---|---|
| 85 | |
| 69 | |
| 38 | |
| 29 | |
| 27 |