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
EDO_01_1789
Helper I
Helper I

Previous date dax or M

Hello 

yes I would like your help about a probleme

I have put below a table of what I want :

Fichier ExcelValidator NameValidation datePrevious validator date
 Excel File  AValidator n° 111/08/2022 
 Excel File  AValidator n° 212/08/202211/08/2022
 Excel File  AValidator n° 313/08/202212/08/2022
 Excel File  AValidator n° 414/08/202213/08/2022
 Excel File  AValidator n° 515/08/202214/08/2022
 Excel File  BValidator n° 102/08/202215/08/2022
 Excel File  BValidator n° 203/08/202202/08/2022
 Excel File  BValidator n° 304/08/202203/08/2022
 Excel File  BValidator n° 405/08/202204/08/2022
 Excel File  BValidator n° 506/08/202205/08/2022
 Excel File  CValidator n° 101/07/202206/08/2022
 Excel File  CValidator n° 202/07/202201/07/2022
 Excel File  CValidator n° 303/07/202202/07/2022
 Excel File  CValidator n° 404/07/202203/07/2022
 Excel File  CValidator n° 505/07/202204/07/2022

 

I can't create the last column in M or DAX.

if anyone could help me it would be very useful

I just want to make sure that the validator 1 of each excel file does not have a previous date.

The validator 2 must have the validation date of the validator 1
The validator 3 must have the validation date of the validator 2
Validator 4 must have the validation date of validator 3
The validator 5 must have the validation date of the validator 4

Thanks for your help,

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @EDO_01_1789 ;

You could create a measure by dax.

 

Measure = 
CALCULATE(MAX('Table'[Validation date]),
FILTER(ALL('Table'),[Fichier Excel]=MAX('Table'[Fichier Excel])&&[Validation date]<MAX('Table'[Validation date])))

 

the final show:

vyalanwumsft_0-1661162364944.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @EDO_01_1789 ;

You could create a measure by dax.

 

Measure = 
CALCULATE(MAX('Table'[Validation date]),
FILTER(ALL('Table'),[Fichier Excel]=MAX('Table'[Fichier Excel])&&[Validation date]<MAX('Table'[Validation date])))

 

the final show:

vyalanwumsft_0-1661162364944.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Vijay_A_Verma
Super User
Super User

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test (later on when you use the query on your dataset, you will have to change the source appropriately. If you have columns other than these, then delete Changed type step and do a Changed type for complete table from UI again)

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jdExCoNAFATQqyxbu/D3765JmwQ9go1YSLQQlgRCihwrZ8jJtBwccNN+XjEzv+9t87nP2bRLns3FVrYb8zKN7+fLPH5f47eLiqqTs/PeDlXBK3ot+4A+lH1EH8s+oU97fz3sK5SfPfYVys8e+wrlZ4995Y/82Ffqvb8d9D05of+yV/S0D/uAnvZhH9HTPuwT+m2fYQU=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Fichier Excel" = _t, #"Validator Name" = _t, #"Validation date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Fichier Excel", type text}, {"Validator Name", type text}, {"Validation date", type date}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1, Int64.Type),
    BuffList = List.Buffer(#"Changed Type"[Validation date]),
    #"Added Custom" = Table.AddColumn(#"Added Index", "Previous validator date", each try BuffList{[Index]-1} otherwise null),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Index"})
in
    #"Removed Columns"

 

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.

Top Solution Authors
Top Kudoed Authors