Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Jeevan1991
Helper III
Helper III

Invoice Number Check

Dear Friends,

 

I have a below set of data.

DateOutletInvoice #
01-Nov-202012435452123
02-Nov-202012435452124
03-Nov-202012435452125
03-Nov-202012435452127
01-Nov-202053435454765
02-Nov-202053435454766
03-Nov-202053435454777
03-Nov-202053435454780

 

I want to check the outletwise invoice number incremnt whether it is increased by 1 or not. Ultimately i want to find the result like the below one.

 

DateOutletInvoice #Invoice #
01-Nov-202012435452123First Invoice number
02-Nov-202012435452124Incresed By 1
03-Nov-202012435452125Incresed By 1
03-Nov-202012435452127Not Incresed By 1
01-Nov-202053435454765First Invoice number
02-Nov-202053435454766Incresed By 1
03-Nov-202053435454777Not Incresed By 1
03-Nov-202053435454780Not Incresed By 1

 

@amitchauhan @amitchandak @jazzk @v-easonf-msft @speedramps

2 ACCEPTED SOLUTIONS

Hi @Jeevan1991 ,

 

A first thing - please remove a summarization for the Rank column:

lkalawski_0-1607695059532.png

Second thing - please add Dense to Rank function as a last argument.

 

 

Rank = 
RANKX (
    FILTER (
        DAILY_BILLWISE_SALES,
        DAILY_BILLWISE_SALES[CAFEID] = EARLIER ( DAILY_BILLWISE_SALES[CAFEID] )
    ),
    DAILY_BILLWISE_SALES[BILLNO],
    ,
    ASC,
    Dense
    
)

 

The result:

lkalawski_1-1607695148927.png


pbix file: https://gofile.io/d/phJrox 
_______________
If I helped, please accept the solution and give kudos! 😀

 

 

View solution in original post

Hi Bro,

 

The above method giving me inconsistent results.

 

For an example look at the below screenshot where i have filtered just one cafe.

Jeevan1991_0-1607921818284.png

 

Even though "BillNo" 102 is the first bill number it is showinng the rank as 21, because of this invoice Order too showing wrongly.

 

Column Used is = 

Jeevan1991_0-1607922225726.png

 

 
Measure used is 
Jeevan1991_1-1607922282766.png

 

 

Please help me on this bro.

 
 

 

View solution in original post

8 REPLIES 8
lkalawski
Memorable Member
Memorable Member

Hi @Jeevan1991 ,

 

You can use calculated column and measure to achieve this:
Calculated column:

Rank = 
RANKX (
    FILTER (
        'Table',
        'Table'[Outlet] = EARLIER ( 'Table'[Outlet] )
    ),
    'Table'[Invoice #],
    ,
    ASC
)

Measure:

Invoice Order = 
VAR __PreviousNumber = MAX('Table'[Rank]) - 1
VAR __Diff = 
MAX('Table'[Invoice #]) -
CALCULATE(
     MAX('Table'[Invoice #]), FILTER(ALL('Table'), 'Table'[Outlet] = MAX('Table'[Outlet]) && 'Table'[Rank] = __PreviousNumber)) 

RETURN 
 SWITCH(MAX('Table'[Rank]),
 1, "First Invoice number",
 SWITCH(__Diff,
 1, "Incresed By 1",
 "Not Incresed By 1"
 )
 )

 

The result:

lkalawski_0-1607679480133.png



_______________
If I helped, please accept the solution and give kudos! 😀

Hi @lkalawski 

 

Thanks for the solution.

 

Please send me PBIX file please.

@Jeevan1991 

Please find the file here:

https://gofile.io/d/f8x4KD



_______________
If I helped, please accept the solution and give kudos! 😀

Bro,

 

For me RANK is giving me different result.

 

Jeevan1991_2-1607682104051.png

For used is.

Jeevan1991_3-1607682206014.png

 

 

@Jeevan1991 

Do you have the same value for Rank in the Data View?

Could you please share your pbix file?



_______________
If I helped, please accept the solution and give kudos! 😀 

Hi Bro,

 

In the below link i have uploaded the sample file.

 

https://gofile.io/d/FKTse6 

Hi @Jeevan1991 ,

 

A first thing - please remove a summarization for the Rank column:

lkalawski_0-1607695059532.png

Second thing - please add Dense to Rank function as a last argument.

 

 

Rank = 
RANKX (
    FILTER (
        DAILY_BILLWISE_SALES,
        DAILY_BILLWISE_SALES[CAFEID] = EARLIER ( DAILY_BILLWISE_SALES[CAFEID] )
    ),
    DAILY_BILLWISE_SALES[BILLNO],
    ,
    ASC,
    Dense
    
)

 

The result:

lkalawski_1-1607695148927.png


pbix file: https://gofile.io/d/phJrox 
_______________
If I helped, please accept the solution and give kudos! 😀

 

 

Hi Bro,

 

The above method giving me inconsistent results.

 

For an example look at the below screenshot where i have filtered just one cafe.

Jeevan1991_0-1607921818284.png

 

Even though "BillNo" 102 is the first bill number it is showinng the rank as 21, because of this invoice Order too showing wrongly.

 

Column Used is = 

Jeevan1991_0-1607922225726.png

 

 
Measure used is 
Jeevan1991_1-1607922282766.png

 

 

Please help me on this bro.

 
 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.