March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I want to convert
count(distinct(case when invoice_type_id in (1,3,5,9) then sys_invoice_no else null end))
-
count(distinct(case when invoice_type_id in (7,14) and full_return_flag = 1 then sys_invoice_no else null end)) as tickets
to a dax measure. Can this be done?
Solved! Go to Solution.
Hi,
I'm not sure if i've read your code correctly but something like this might work
Tickets =
CALCULATE( DISTINCTCOUNT( 'Table'[sys_invoice_no] ),
'Table'[invoice_type_id] IN ( {1,3,5,9} ) ) -
CALCULATE( DISTINCTCOUNT( 'Table'[sys_invoice_no] ),
'Table'[invoice_type_id] IN ( {7,14} ),
'Table'[full_return_flag] = 1 )
Hi @Anonymous ,
You could try this DAX and tell me if it works.
tickets = SWITCH ( TRUE (), 'Table'[invoice_type_id] IN { 1, 3, 5, 9 }, DISTINCTCOUNT ( 'Table'[sys_invoice_no] ), BLANK () ) - SWITCH ( TRUE (), AND ( 'Table'[invoice_type_id] IN { 7, 14 }, 'Table'[full_return_flag] = 1 ), DISTINCTCOUNT ( 'Table'[sys_invoice_no] ), BLANK () )
Hi,
I'm not sure if i've read your code correctly but something like this might work
Tickets =
CALCULATE( DISTINCTCOUNT( 'Table'[sys_invoice_no] ),
'Table'[invoice_type_id] IN ( {1,3,5,9} ) ) -
CALCULATE( DISTINCTCOUNT( 'Table'[sys_invoice_no] ),
'Table'[invoice_type_id] IN ( {7,14} ),
'Table'[full_return_flag] = 1 )
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
132 | |
90 | |
88 | |
64 | |
58 |
User | Count |
---|---|
203 | |
141 | |
107 | |
73 | |
70 |