Forum

PLEASE - FROM fisca...
 
Notifications
Clear all

PLEASE - FROM fiscal italian code to date of birth - odyssey

7 Posts
2 Users
0 Reactions
208 Views
(@stevefromvicenza)
Posts: 22
Eminent Member
Topic starter
 

Hello world 😉

for me it's impossible but i'm sure someone can help me.Laugh

This is the excel formula:

=DATE(IF(2000+MID(B6,7,2)>YEAR(TODAY()),MID(B6,7,2),2000+MID(B6,7,2)),FIND(MID( B6,9,1),"ABCDEHLMPRST"),MOD(MID(B6,10,2),40))

iI try this

"date(if(2000+Text.Middle([B6,7,2)>YEAR(TODAY()),Text.Middle(B6,7,2),2000+Text.Middle(B6,7,2)),FIND(Text.Middle( B6,9,1),"ABCDEHLMPRST"),MOD(Text.Middle(B6,10,2),40))

 

but it does not work ConfusedConfusedConfused

 
Posted : 22/04/2019 4:23 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Stefano,

You can't reference cells in Power Query, so this:

Text.Middle(B6,7,2) will not be recognised, unless you happen to have a column called 'B6'.

Power Query also doesn't recognise the YEAR, TODAY, MOD and FIND functions. These are Excel functions. You need to find the Power Query equivalents.

That said, please upload a sample Excel file that references data in the workbook i.e. don't get data from an external file/folder/database. Show us the 'before' view and the desired result. From there we can help you with a Power Query solution.

Mynda

 
Posted : 22/04/2019 7:47 pm
(@stevefromvicenza)
Posts: 22
Eminent Member
Topic starter
 

Thanks a lot Mynda Cool

you will find attached the worksheet .

 

Stefano

 
Posted : 23/04/2019 5:06 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Stefano,

Please see file attached. There are quite a few steps, but it makes no difference to Power Query's efficiency if it's not squashed into one single formula. That is the beauty of the query editor 🙂

Mynda

 
Posted : 23/04/2019 7:03 am
(@stevefromvicenza)
Posts: 22
Eminent Member
Topic starter
 

KissKissKiss

 
Posted : 23/04/2019 7:38 am
(@stevefromvicenza)
Posts: 22
Eminent Member
Topic starter
 

Hi Mynda,

thanks for your "wise solution"Cool but I don't understand the meaning of one step...
this is the step

#"Inserted Modulo" = Table.AddColumn(#"Added Custom1", "Day", each Number.Mod([#"Column1(before).2.2.2.1"], 40), type number),

Or better I need the following operation :
"if the value of the day is greater than 40 reduce it by 40"....but how is applied this in  logical steps with the "module"???

 
Posted : 23/04/2019 8:50 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Stefano,

In your Excel formula you had MOD(Text.Middle(B6,10,2),40)

The Modulo step in Power Query replicates this calculation in your Excel formula. i.e. Number.Mod is the equivalent Power Query function to Excel's MOD function.

Mynda

 
Posted : 23/04/2019 7:02 pm
Share: