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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
CSpina
Helper III
Helper III

How to filter table results using different type of dates

Hi, guys and girls.

 

I need to filter a table results using different types of date (invoice date, ship date and delivery date):

2021_07_27_20_55_53_Exemplo_de_Tabela_por_Tipo_de_Data_Power_BI_Desktop.png

But how the active relationship is between dCalendar[Date] and fInvoice[Invoice date], I don´t knoww how to do it:

 

2021_07_27_20_58_11_Exemplo_de_Tabela_por_Tipo_de_Data_Power_BI_Desktop.png

 

Any ideas? Please see tests tables below:

 

fInvoices

let
Fonte = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fdBLCoAwDATQq0jWgklq/aw9RnHpUgQ/99dKi9OKQjcDzes0zpFQScOx7cs8rYUPLNV1lNUHwxDYVqwxCDPTWDpSBDRce2YEZhJAI2BeDRDQDh9NGtgA1AjUdzcAxGbhaRABi4DJgfQLGKQPQPMLmM8Q59t8BT+lk300HhhP", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [IDInvoice = _t, Customer = _t, #"Invoice Date" = _t, #"Ship Date" = _t, #"Delivery date" = _t, Total = _t]),
#"Tipo Alterado" = Table.TransformColumnTypes(Fonte,{{"Delivery date", type date}, {"Ship Date", type date}, {"Invoice Date", type date}, {"Total", type number}, {"IDInvoice", Int64.Type}})
in
#"Tipo Alterado"

 

dDate Type

let
Fonte = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcknNySxLLapUcEksSVSK1YlW8swry89MTlVISSxJBQsEZ2QWQHmxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Type = _t]),
#"Tipo Alterado" = Table.TransformColumnTypes(Fonte,{{"Type", type text}})
in
#"Tipo Alterado"

 

 

 

1 REPLY 1
Greg_Deckler
Super User
Super User

@CSpina You can do this using the USERELATIONSHIP function to specify the relationship that you want. Another way to do this is to have "role playing dimensions", in other words, one date table for each of your date types, shipping, invoice and delivery.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.