Forum Discussion
Two DAX calculated column needed for calculate returning customer series and no of invoice
- 3 years ago
Hi PijushRoy ,
Redo the calculation to:
CUST SERIES = VAR MAXINVOICE = IF ( Data[Hown Many Invoices] = 1, Data[Index],Data[Index]+ Data[Hown Many Invoices]-1 ) RETURN IF ( Data[Hown Many Invoices] <> BLANK (), Data[Invoice_ID] & "-" & MAXX ( FILTER ( ALL ( Data ), Data[Index] = MAXINVOICE ), Data[Invoice_ID] ) )
PijushRoy you haven't provided more information
i haven't done all of it but is this what you are looking for? please confirm - you haven't give enough information, you havent provided an expected solultion. If you need help you do need to provide a clear set of what is expected.
- PijushRoy3 years agoCommunity Champion
vanessafvg
Can you please share the pbix, when I applied calcualtion, I am not getting same data as you mentioned in image.- vanessafvg3 years agoCommunity Champion
it changed thats probably why. Its still not perfect however but i am unsure of what you want so please clarify with the exact results.
Get UniqueCust =
VAR selinvoiceid =
SELECTEDVALUE ( Data[Invoice_ID] )
VAR mininvoiceid =
CALCULATE ( MIN ( Data[Invoice_ID] ) )
VAR maxindex =
CALCULATE (
MIN ( Data[Index] ) - 1,
ALL ( data ),
Data[Invoice_ID] > mininvoiceid
&& Data[Unique_Cust] > 1
)
VAR minindex =
CALCULATE (
MAX ( Data[Index] ),
ALL ( data ),
Data[Index] < maxindex
&& Data[Unique_Cust] > 1
)
VAR firstinvoiceid =
CALCULATE ( MIN ( Data[Invoice_ID] ), ALL ( Data ), Data[Index] = minindex )
VAR maxinvoiceid =
CALCULATE ( MAX ( Data[Invoice_ID] ), ALL ( data ), Data[Index] = maxindex )
VAR result =
IF ( selinvoiceid = maxinvoiceid, selinvoiceid, firstinvoiceid ) & "-"
& IF ( ISBLANK ( maxinvoiceid ), mininvoiceid, maxinvoiceid )
RETURN
result