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

Create a measure to get the entire month value based on selected date.

Hi, I am trying to build a report which needs a DAX that I am having some trouble with. 

 

I have a table which has the following structure:

Pratik1802_0-1685829184710.png

I want to create a report using a matrix visual that looks like:

Pratik1802_1-1685829238750.png

The issue that I am facing is wit hthe Month Amount_EUR measure. The user is going to select any 1 date (Invoice date) in th date slicer and then based on that the report should show the Month Amount for that entire month. One more point to note is that there may not be any invoice created for a specific country- legal entity pair for that selected date but there many by a value for some other date in that month. So in this case as well we should get the month amount_eur value. 

 

Any helo would be much appriciated and if you need more information or something is not clear please let me know.

 

Thanks!

 

 

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @Pratik1802 ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data.  

vtangjiemsft_0-1685946541742.png

(2) We can create a table and a measure. 

vtangjiemsft_1-1685946850924.png

 

Table 2 = VALUES('Table'[INVOICE_DATE])
month amount_eur = 
 var _a=SELECTEDVALUE('Table 2'[INVOICE_DATE])
 var _b= CALCULATE(SUM('Table'[Today Amount_Eur]),FILTER(ALL('Table'),'Table'[COUNTRY_ID]=MAX('Table'[COUNTRY_ID]) && 'Table'[LEGAL_ENTITY_ID]=MAX('Table'[LEGAL_ENTITY_ID]) && YEAR('Table'[INVOICE_DATE])=YEAR(_a) && MONTH('Table'[INVOICE_DATE]) =MONTH(_a)))
 return _b

(3) Then the result is as follows.

vtangjiemsft_2-1685946897405.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

1 REPLY 1
v-tangjie-msft
Community Support
Community Support

Hi @Pratik1802 ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data.  

vtangjiemsft_0-1685946541742.png

(2) We can create a table and a measure. 

vtangjiemsft_1-1685946850924.png

 

Table 2 = VALUES('Table'[INVOICE_DATE])
month amount_eur = 
 var _a=SELECTEDVALUE('Table 2'[INVOICE_DATE])
 var _b= CALCULATE(SUM('Table'[Today Amount_Eur]),FILTER(ALL('Table'),'Table'[COUNTRY_ID]=MAX('Table'[COUNTRY_ID]) && 'Table'[LEGAL_ENTITY_ID]=MAX('Table'[LEGAL_ENTITY_ID]) && YEAR('Table'[INVOICE_DATE])=YEAR(_a) && MONTH('Table'[INVOICE_DATE]) =MONTH(_a)))
 return _b

(3) Then the result is as follows.

vtangjiemsft_2-1685946897405.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.