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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Ghuiles
Advocate IV
Advocate IV

Latest commentary based on month and country selection

Hello

 

I think i am struggling with something simple.

 

I have a table with Comments

DateRegionComment
1/09/2019EuropeBetter sales on market A
1/10/2019AsiaStrong demand on X
1/10/2019EuropeNtd

 

This table is linked to a DimDate table.

The comments are provided only per month.

 

So, in DAX, how can i show the comments only for the latest month selected?

At the end the user should see either one comment for one region, or if several regions then several comments.
I think that the best object is a table or a matrix.

 

I tried to build something with MAXDimDate[Date]) or MAX(DimDate[YearMonth]) and VALUES but it did not work.

What i am missing?

 

Thanks in advance for your help. G.

2 ACCEPTED SOLUTIONS
v-yuta-msft
Community Support
Community Support

@Ghuiles ,

 

Create a measure using dax as below, please refer to the attached pbix file.

Selected Date = IF(CALCULATE(MAX('Dimension'[Date]), ALLSELECTED('Dimension')) = MAX('Fact'[Date]), MAX('Fact'[Date]))

Capture.PNG 

 

Community Support Team _ Jimmy Tao

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

Hello!

 

@v-yuta-msft many thanks for your idea! I managed to build on that with EOMONTH to get the months flattened, and it works now as desired 🙂

 

At the end the formula looks like: 

IF(CALCULATE(EOMONTH(MAX('DimDate'[Date]),0), ALLSELECTED('DimDate')) = EOMONTH(MAX('Sales Comments'[Date]),0), eoMONTH(MAX('Sales'Comments'[Date]),0))
 
Cheers. G.

View solution in original post

5 REPLIES 5
v-yuta-msft
Community Support
Community Support

@Ghuiles ,

 

Create a measure using dax as below, please refer to the attached pbix file.

Selected Date = IF(CALCULATE(MAX('Dimension'[Date]), ALLSELECTED('Dimension')) = MAX('Fact'[Date]), MAX('Fact'[Date]))

Capture.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for your proposal! 🙂

hmm. I think we are close to the solution, but still not fully there.

The user is indeed selecting the month via a slicer on DimDate[Month].

DimDate and the Fact tables are linked via the field [Date], so not month.

 

Somehow it still does not work 😞

No matter which month it is selected (only September, the full year, all months before Sept etc), the result is blank.

I unfortunately cannot post my model.
Any clue on how to solve this?

 

 

Hello!

 

@v-yuta-msft many thanks for your idea! I managed to build on that with EOMONTH to get the months flattened, and it works now as desired 🙂

 

At the end the formula looks like: 

IF(CALCULATE(EOMONTH(MAX('DimDate'[Date]),0), ALLSELECTED('DimDate')) = EOMONTH(MAX('Sales Comments'[Date]),0), eoMONTH(MAX('Sales'Comments'[Date]),0))
 
Cheers. G.
amitchandak
Super User
Super User

When you say a latest selected month. So once filter on a month of your date then you will get that month data.

 

Can you share sample data and sample output. Thanks.
Proud to be a Datanaut My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

Hi!

The problem is that the user can select for example Jan, Feb, March. But we would like to see only the comments related to March.

Best regards. G.

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

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.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Find out what's new and trending in the Fabric Community.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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