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
EvertonRosa
Helper I
Helper I

Sum till business day

Hi ALL

 

I need a little help to adjust the following DAX function:

 

VAR FirstDay = STARTOFMONTH(dCalendar[ID Data])
RETURN

CALCULATE(SUM(fOportunies[total]),
   fOportunies[status] ="open",
   USERELATIONSHIP(dCalendar[ID Data],fOportunies[estimateddate]),
    fOportunies[createdon] <= FirstDay
)

The adjustment that I need to do is change that VAR FirstDay should consider the 5º business day of each month.

 

I do have on dCalendar table a defined struture to set business day, with 0 for NO and 1 for YES (id date is or not a business day).

2 REPLIES 2
Greg_Deckler
Super User
Super User

@EvertonRosa Probably need to ditch STARTOFMONTH and calculate your first day using something like MINX(FILTER(...),...) or CALCULATE(MIN(...),...) Hard to tell you specifically without a representation of your data. But basically filter to the same month and year and businessday = 1 and grab the min value.

 

This might help in the future: You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Greg

 

Here is my dCalendar

 

EvertonRosa_0-1631130697604.png

 

Chech column "Dia Útil". In case, i do want to adjust filter/code:

 fOportunies[createdon] <= FirstDay

 

"Firstday" should sum "Dia Útil" = 5 and get ID Data Value. Do you know how to do it?

 

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.

Top Solution Authors