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
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
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.