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.
Is it possible to add a a filter in the following formula based on a calculated column? I need to exclude every number 7 in the calculation from the calendar table which it means weekends.
Avg Total 2 =
VAR Months =
COUNTROWS ( ALLSELECTED ( PBI[Fecha] ) )
RETURN
IF (
ISINSCOPE ( PBI[Fecha] );
SUM ( PBI[Total] );
DIVIDE ( SUM ( PBI[Total] ); Months )
)
this formula shows the folowing result:
Solved! Go to Solution.
hi @Anonymous
WEEKDAY(<date>, <return_type>)
add a parameter in the formula
return_type | A number that determines the Return value: Return type: 1, week begins on Sunday (1) and ends on Saturday (7). numbered 1 through 7. Return type: 2, week begins on Monday (1) and ends on Sunday (7). Return type: 3, week begins on Monday (0) and ends on Sunday (6).numbered 1 through 7. |
https://docs.microsoft.com/en-us/dax/weekday-function-dax
Then adjust the formula as below:
CALCULATE(COUNTROWS(FILTER(ALLSELECTED(PBI),[WEEKDAY]<6)))
If you still have the problem, please share a simple sample pbix file, and your expected output.
Regards,
Lin
@Anonymous do you have column for 7th day in calendar? If yes, you can simple filter it in the filter pane or in your DAX
for example, you have calendar dimension with weekDay column from 1 to 7 and you can put filter in DAX to exclude 7th day.
Sum =
CALCULATE ( SUM ( Table[Amount] ),
Calendar[WeekDay] < 7
)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @parry2k , thanks for helping me out... As you see the picture, the formula I created is to make a unique total column at the end of the matrix...in that example what the formula does is to sum the numbers and divided by the days...in this example first row we have the sum is 5 and divide by the numbers of days...in this case 18 days , so the result for the first row is 0,28 which is correct... but I need to exclude weekends and holidays.... in this case the desire result for the first row would be sum of 5 divided by 13 days (not 18 as the previous example).... in my table I have this column where it marks every saturday, sunday, and holiday with the number 7:
Any suggestion in the formula?
hi @Anonymous
WEEKDAY(<date>, <return_type>)
add a parameter in the formula
return_type | A number that determines the Return value: Return type: 1, week begins on Sunday (1) and ends on Saturday (7). numbered 1 through 7. Return type: 2, week begins on Monday (1) and ends on Sunday (7). Return type: 3, week begins on Monday (0) and ends on Sunday (6).numbered 1 through 7. |
https://docs.microsoft.com/en-us/dax/weekday-function-dax
Then adjust the formula as below:
CALCULATE(COUNTROWS(FILTER(ALLSELECTED(PBI),[WEEKDAY]<6)))
If you still have the problem, please share a simple sample pbix file, and your expected output.
Regards,
Lin
I still cant do it... maybe the model doesnt allow it.
If you can take a look at my sample data would be so nice:
PBIX:
https://www.dropbox.com/s/7jtgn0e65ongubv/BI%20VISITAS%20DEMO%20forum.pbix?dl=0
Desire output in excel:
https://www.dropbox.com/s/r7eih1bzsw76edo/DISIRED%20OUTPUT.xlsx?dl=0
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |