cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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:

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

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
Community Support

Hi @Pratik1802 ,

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

(1) This is my test data.

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

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

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.

Community Support

Hi @Pratik1802 ,

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

(1) This is my test data.

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

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

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.

Announcements

#### Fabric certifications survey

Certification feedback opportunity for the community.

#### Power BI Monthly Update - April 2024

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

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors