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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Anonymous
Not applicable

Need a measure

Hi,

I have to calculate a measure which should be based on the following logic:

 

if "weekend date" = in between ("quarter start date" and "quarter end date") then "Total Hours" else "0"

 

Note: "Total Hours" is a measure which 3 others are table's columns -"weekend date" , "quarter start date" and "quarter end date"

 

Thanks

@az38 

@Greg_Deckler 

1 ACCEPTED SOLUTION

@Anonymous ,

 

Create a measure using dax as below:

Result = IF(MAX('Table'[weekend date]) >= MAX('Table'[Quarter Start Date]) && MAX('Table'[weekend date]) <= MAX('Table'[Quarter End Date]), MAX('Table'[Total Hours]), 0)

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

6 REPLIES 6
amitchandak
Super User
Super User

The information you have provided is not making the problem clear to me. Can you please explain with an example.
Can you share sample data and sample output.

See if this file can help you. https://www.dropbox.com/s/bu47m5ek7sr9v8t/sales_analytics_v2.pbix?dl=0

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Hi,

 

I believe this would be more clear:

weekend dateQuarter Start DateQuarter End DateTotal Hours(Required Measure)
2/23/20201/6/20204/5/2020140140
5/20/20204/6/20207/5/20208989
1/2/20204/6/20207/5/20201230
6/8/20201/6/20204/5/2020880
3/12/20201/6/20204/5/2020212212

@Anonymous ,

 

Create a measure using dax as below:

Result = IF(MAX('Table'[weekend date]) >= MAX('Table'[Quarter Start Date]) && MAX('Table'[weekend date]) <= MAX('Table'[Quarter End Date]), MAX('Table'[Total Hours]), 0)

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

az38
Community Champion
Community Champion

@Anonymous 

 

Measure=
var _weekendDate = SELECTEDVALUE(Table[weekend date])
IF(_weekendDate >= SELECTEDVALUE(Table[quarter start date]) && _weekendDate <= SELECTEDVALUE(Table[quarter end date]), Table[TotalTime], 0)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
az38
Community Champion
Community Champion

@Anonymous 

will it help a simple statement like

Measure=
IF(Table[weekend date] >= Table[quarter start date] && Table[weekend date] <= Table[quarter end date], Table[TotalTime], 0)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
MFelix
Super User
Super User

Hi @Anonymous ,

 

Please see this post regarding How to Get Your Question Answered Quickly (courtesy of @Greg_Deckler) and How to provide sample data in the Power BI Forum (courtesy of @ImkeF).

 

Without example data is difficult to give you a better help.

 

If you can share a sample data (especially on the dates columns) and if you are using a calendar table or dates within your data table would be helpfull to assist you.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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