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
iradann
Regular Visitor

Time period

 

Hi!
Can`t solve the problem: I need to create a calculated column that includes campaings periods in "dd.mm.yyyy - dd.mm.yyyy" format.

 

I have  dim_dates table  that has a lot of  information (e.g., [date] has time in a "dd.mm.yyyy" format) and dim_campaign table with campaing`s ids. These two tables are connected by a fact table.

Screenshot_8.png

 

 

Screenshot_9.png

 

 

So, what should I do to get the periods in the neccessary format?

6 REPLIES 6
dilumd
Solution Supplier
Solution Supplier

I’m sorry! Don’t know whether I understood your question correctly, but I think you must format your table fields correctly first and then relate them with fields which are in the same type. Depending on your data table select either single join or both join under join options.

CahabaData
Memorable Member
Memorable Member

What is the common field to both tables?

www.CahabaData.com

There is dates_id and campaigns_id fields in the fact table.Screenshot_10.png

Generically speaking; with the tables correctly joined one can create:

 

Campaign   Min(Date)    Max(Date)

 

You can do this at the table level, via a calculated table/field if you want to establish that permanently for other uses - or - the table visual will give you this as a presentation, by dragging the Date field twice and using the field setting options.

 

Date formating option is available in Modeling in the ribbon as a selection and if you need something more unique that isn't offered there then one would use a Dax format statement via measure or calculated field.

 

 

 

 

www.CahabaData.com

I have created a calculated column Period= CALCULATE ( FORMAT ( MIN ( dim_dates[date] ); "dd.mm.yyyy" ) ) & " - " & CALCULATE ( FORMAT ( MAX ( dim_dates[date] ); "dd.mm.yyyy" ) )

but it doesnt work quite right. 
In the table view it shows me the result as in the photo for one campaing, instead of one row with 11.06.2017-14.06.2017Screenshot_11.png

T.jpg

 

Desired Output=CALCULATE(MAX([Check]),

                                                    FILTER(Table1,[Name]=EARLIER([Name]))

                                                    )

 

Here's a model of a Max creation that maybe helps you craft your design

 

I would do Max and Min in separate fields at first - they may be useful by themselves for other purposes in the long run - and then you can make a 3rd field that is them together as you seek.....

 

 

www.CahabaData.com

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.