Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Dear Community,
again, I am lost in the depth of Power BI and DAX. Any help greatly appreciated!
I have the following table 'Sales':
Deal ID | Deal Closed | Deal Won | Reseller |
001 | FALSE | FALSE | A |
002 | TRUE | FALSE | B |
002 | TRUE | FALSE | B |
002 | TRUE | FALSE | C |
003 | FALSE | FALSE | A |
004 | TRUE | FALSE | B |
005 | TRUE | TRUE | A |
005 | TRUE | TRUE | A |
006 | TRUE | TRUE | B |
007 | TRUE | FALSE | A |
007 | TRUE | FALSE | A |
007 | TRUE | FALSE | C |
008 | TRUE | FALSE | A |
To find out, which reseller was involved in how many deals close lost, I have created the following measure (using help from this thread).
Please note: For one and the same deal (same Deal ID) it might happen, that
COUNT_Reseller_Lost =
CALCULATE (
DISTINCTCOUNT ( 'Sales'[Deal ID] ),
FILTER (
ALLEXCEPT ( 'Sales', 'Sales'[Reseller] ),
'Sales'[Deal Closed] = TRUE ()
&& 'Sales'[Deal Won] = FALSE ()
)
)
This measure brings me the ring counts for each reseller, but unfortunately, the total is wrong!
How to I have to adjust the measure, that both the values for each Reseller and the Total are displayed correctly?
Thank you very much!
Mister_T
Solved! Go to Solution.
Hi @Mister_T ,
Create a second measure:
#Result =
IF(HASONEVALUE('Sales'[Reseller]),
[COUNT_Reseller_Lost],
SUMX(VALUES('Sales'[Reseller]), [COUNT_Reseller_Lost])
)
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
Hi @Mister_T ,
Create a second measure:
#Result =
IF(HASONEVALUE('Sales'[Reseller]),
[COUNT_Reseller_Lost],
SUMX(VALUES('Sales'[Reseller]), [COUNT_Reseller_Lost])
)
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
@Mister_T , Try
COUNT_Reseller_Lost =
CALCULATE (
DISTINCTCOUNT ( 'Sales'[Deal ID] ),
FILTER ('Sales' ,
coalesce(CALCULATE(Max('Sales'[Deal Closed]) , ALLEXCEPT ( 'Sales', 'Sales'[Deal ID] )), false()) =True(),
&& 'Sales'[Deal Won] = FALSE ()
)
)
Hi @amitchandak,
Thank you very much!
Unfortunately, your DAX formula returns
"The syntax for '&&' is incorrect. (DAX(CALCULATE (DISTINCTCOUNT ( 'Sales'[Deal ID] ),FILTER ('Sales' ,coalesce(CALCULATE(Max('Sales'[Deal Closed]) , ALLEXCEPT ( 'Sales', 'Sales'[Deal ID] )), false()) =True(),&& 'Sales'[Deal Won] = FALSE ()))))."
Deleting the ',' after "TRUE ()",
COUNT_Reseller_Lost_NEW =
CALCULATE (
DISTINCTCOUNT ( 'Sales'[Deal ID] ),
FILTER ('Sales' ,
COALESCE (
CALCULATE(
Max('Sales'[Deal Closed]) ,
ALLEXCEPT ( 'Sales', 'Sales'[Deal ID] )
),
FALSE ()
)
=TRUE ()
&& 'Sales'[Deal Won] = FALSE ()
)
)
lets the formula pass as measure, but as soon as I want to use it in a vizual, I get the error message
Any alternative to 'MAX' when it cannot work with BOOLEAN?
Thanks a lot!
@Mister_T , Try like
COUNT_Reseller_Lost_NEW = CALCULATE ( DISTINCTCOUNT ( 'Sales'[Deal ID] ), FILTER ('Sales' , COALESCE ( CALCULATE( Count('Sales'[Deal Closed]), 'Sales'[Deal Closed] = TRue() , ALLEXCEPT ( 'Sales', 'Sales'[Deal ID] ) ), 0 ) <>0 && 'Sales'[Deal Won] = FALSE () ) )
Thank you, @amitchandak! Your help is greatly appreciated.
Unfortunatelly, here again, I get an error message, when using this measure as value for a table (or any other) visual:
"The function COUNT cannot work with values of type Boolean."
Best regards,
Mister_T
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
104 | |
69 | |
48 | |
41 | |
34 |
User | Count |
---|---|
164 | |
112 | |
62 | |
54 | |
38 |