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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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.


Follow on LinkedIn
@ 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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