The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi, can you help count the number of weeks in the selected month? Instead of using the hardcoded value '4', it should calculate the number of weeks in the selected month.
Measure:
Budget = 'Budget'[Budget $ SUM]/4
Thanks!
Solved! Go to Solution.
Thanks for the reply from@lbendlin ,please allow me to provide another insight:
Regarding the issue you raised, my solution is as follows:
1.First I have created the following table and the column names and data are the data you have given:
2.Create calculated column references:
weeknumber = WEEKNUM('Table'[Date])
3. Below are the measure I've created for your needs:
Budget =
VAR number1=DISTINCTCOUNT('Table'[weeknumber])
RETURN 'Table'[Budget $ SUM]/number1
4.Here's my final result, which I hope meets your requirements.
5.Here is the relevant documentation:
WEEKNUM function (DAX) - DAX | Microsoft Learn
Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the reply from@lbendlin ,please allow me to provide another insight:
Regarding the issue you raised, my solution is as follows:
1.First I have created the following table and the column names and data are the data you have given:
2.Create calculated column references:
weeknumber = WEEKNUM('Table'[Date])
3. Below are the measure I've created for your needs:
Budget =
VAR number1=DISTINCTCOUNT('Table'[weeknumber])
RETURN 'Table'[Budget $ SUM]/number1
4.Here's my final result, which I hope meets your requirements.
5.Here is the relevant documentation:
WEEKNUM function (DAX) - DAX | Microsoft Learn
Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
What is your definition of week? Do you want to see an integer number or a decimal number (4.428571428571 weeks, for example) ?
User | Count |
---|---|
20 | |
8 | |
7 | |
7 | |
6 |
User | Count |
---|---|
28 | |
12 | |
11 | |
9 | |
8 |