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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ryan012620
New Member

EOMonth use the filter date instead

Can someone help me with this DAX.

 

CALCULATE(SUM('Leasing Metrics'[Future Occupancy]),'Leasing Metrics'[Date]=EOMONTH('Leasing Metrics'[Date],-1)+1)/CALCULATE(SUM('Leasing Metrics'[Total Units]),'Leasing Metrics'[Date]=EOMONTH('Leasing Metrics'[Date],-1)+1)
 
Instead of using 'Leasing Metrics'[Date] for EOMONTH, I need to use the 'Date'[Date] which is being use as a filter.
2 ACCEPTED SOLUTIONS
v-huijiey-msft
Community Support
Community Support

Hi @ryan012620 ,

 

Your request is too vague. I hope you can provide me with sample data and expected results. Do not take screenshots. Please remember to erase sensitive data. It would be better if you can provide the pbix file. Remember not to log in to your account on Power BI Desktop when uploading the pbix file.

 

Instead of using 'Leasing Metrics'[Date] for EOMONTH, You need to use the 'Date'[Date] which is being use as a filter.

 

First, you need to establish a relationship between the two tables through the Date field in the Leasing Metrics table and the Date table.

 

Secondly, modify the measure syntax as follows:

CALCULATE(
     SUM('Leasing Metrics'[Future Occupancy]),
     'Leasing Metrics'[Date] = EOMONTH(MAX('Date'[Date]), -1) + 1
)
/
CALCULATE(
     SUM('Leasing Metrics'[Total Units]),
     'Leasing Metrics'[Date] = EOMONTH(MAX('Date'[Date]), -1) + 1
)

 

You can try using this modified measure to see if it meets your needs.

 

If you have any further questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

I cannot understand what you want but try this

Measure = DIVIDE(CALCULATE(SUM('Leasing Metrics'[Future Occupancy]),DATESBETWEEN('Date'[Date],min('Date'[Date]),min('Date'[Date])))/CALCULATE(SUM('Leasing Metrics'[Total Units]),DATESBETWEEN('Date'[Date],min('Date'[Date]),min('Date'[Date]))))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

I cannot understand what you want but try this

Measure = DIVIDE(CALCULATE(SUM('Leasing Metrics'[Future Occupancy]),DATESBETWEEN('Date'[Date],min('Date'[Date]),min('Date'[Date])))/CALCULATE(SUM('Leasing Metrics'[Total Units]),DATESBETWEEN('Date'[Date],min('Date'[Date]),min('Date'[Date]))))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-huijiey-msft
Community Support
Community Support

Hi @ryan012620 ,

 

Your request is too vague. I hope you can provide me with sample data and expected results. Do not take screenshots. Please remember to erase sensitive data. It would be better if you can provide the pbix file. Remember not to log in to your account on Power BI Desktop when uploading the pbix file.

 

Instead of using 'Leasing Metrics'[Date] for EOMONTH, You need to use the 'Date'[Date] which is being use as a filter.

 

First, you need to establish a relationship between the two tables through the Date field in the Leasing Metrics table and the Date table.

 

Secondly, modify the measure syntax as follows:

CALCULATE(
     SUM('Leasing Metrics'[Future Occupancy]),
     'Leasing Metrics'[Date] = EOMONTH(MAX('Date'[Date]), -1) + 1
)
/
CALCULATE(
     SUM('Leasing Metrics'[Total Units]),
     'Leasing Metrics'[Date] = EOMONTH(MAX('Date'[Date]), -1) + 1
)

 

You can try using this modified measure to see if it meets your needs.

 

If you have any further questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

ryan012620
New Member

ryan012620_1-1714987039026.png

 

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.