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
florian_bi
New Member

How to find first day and last day

Hello,

 

I am looking for a DAX function that can reveal a first day and the last day of each campaign, which are stored in one big table.

 

For each campaign for each month, the start date and the end date is stored in a sep. column. That is in D and C. Now I am wondering if there is any way to search those columns for the "minimum / maximum enrty" within the limitations (or filter) of a name which is given in column A (which will of course be a unique ID in real).

 

florian_bi_0-1693339916775.png

 

thank you for your help! I am really lost...

 

9 REPLIES 9
parry2k
Super User
Super User

@florian_bi good luck!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@florian_bi oh! How many times I have seen that, here is the fix.

 

You should watch these videos on my YT channel if you really want to work with dates.

 

Add Date Dimension
Importance of Date Dimension
Time Intelligence Playlist

 

first daye = CALCULATE(MIN(data[ServiceDate]),ALLEXCEPT(data,data[QuoteId]))

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

oh nice. it seems so work know, but still one question: why do i see all month of the year now, when I have the month column in the table?

 

florian_bi_0-1693436061551.png

 

 

but it does work indeed, if I just have the ID and the first-date column in the table:

florian_bi_1-1693436218954.png

 

 

 

and thank you for the videos! I will watch tomorrow.

 

 

parry2k
Super User
Super User

@florian_bi is it possible to share pbix file using one drive/google drive, remove sensitive information before sharing. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

yes of course. I reduced it to the id of the campaigns and the start date.  you can download the pbix from this link:

https://www.dropbox.com/scl/fi/5kiu3ikllqtjr31rap9bs/lookingforfirstdate.pbix?rlkey=iy894sbv867kzj2f...

 

does this file automaticly include the data from the (local) csv or do i have to attach that as well?

parry2k
Super User
Super User

@florian_bi can you share the measure?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

yes of course. what would I have to do?

 

this is the formula I setup:

first day = CALCULATE(MIN(Angebotsbelegposten[ServiceDate].[Date]),ALLEXCEPT(Angebotsbelegposten,Angebotsbelegposten[QuoteId]))

parry2k
Super User
Super User

@florian_bi add two measures:

 

First Day = 
CALCULATE ( MIN ( Table[Start Date] ), ALLEXCEPT ( Table, Table[Campaign] ) )

Last Day = 
CALCULATE ( MAX ( Table[End Date] ), ALLEXCEPT ( Table, Table[Campaign] ) )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hey Parry,

 

That is what I thought, too. But it does something totally different to the table. Have a look:

florian_bi_0-1693410177762.png

 

The measure I used is this here:

first day = CALCULATE(MIN(Angebotsbelegposten[ServiceDate].[Date]),ALLEXCEPT(Angebotsbelegposten,Angebotsbelegposten[QuoteId]))
 
Any Idea?

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.