The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Dear Community,
I am building a data dashboard for a fitness center and I need some help with calculating the valid number of memberships at the end of every month.
I have the dates, when I sold the different yearly or monhly memberships and the dates until these memberships are valid.
How can I calculate how many valid memberships do I have at the end of every month? Thank you in advance!
Solved! Go to Solution.
So, on first glance you need to decide when we count a valid subsciption within a month and when not. There is a valid subscription on 02/06/2019 yet your table shows 0 for 06.2019. What is the border? What if the enddate is 17/06/2019? Does the value change to 1? What if it is 29/06/2019? Still 0 or actually 1? You need to define that boundry.
I loaded your data into PowerBI and created a calculated table that has every day for each valid membership in it. Because of the question above and your expected result, I assumed that we won't count the month in which a membership ends. The calculated table is this:
GeneratedTable =
GENERATE('Table',
VAR _curStartDate = 'Table'[date sold]
VAR _curEndDate = EOMONTH('Table'[valid until], -1)
RETURN
GENERATESERIES(_curStartDate, _curEndDate))
Then I create a measure that counts the distinct memberships:
DistinctMembers = DISTINCTCOUNT(GeneratedTable[Member number])
Then I created a table visual with DateSold (only Year/Month) and the measure:
PBIX file can be found here: https://1drv.ms/u/s!Ancq8HFZYL_aiItDUonqIklYNkn7Nw?e=SZ73Cx
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
Thank yor very much for the great solution!
Agnes
So, on first glance you need to decide when we count a valid subsciption within a month and when not. There is a valid subscription on 02/06/2019 yet your table shows 0 for 06.2019. What is the border? What if the enddate is 17/06/2019? Does the value change to 1? What if it is 29/06/2019? Still 0 or actually 1? You need to define that boundry.
I loaded your data into PowerBI and created a calculated table that has every day for each valid membership in it. Because of the question above and your expected result, I assumed that we won't count the month in which a membership ends. The calculated table is this:
GeneratedTable =
GENERATE('Table',
VAR _curStartDate = 'Table'[date sold]
VAR _curEndDate = EOMONTH('Table'[valid until], -1)
RETURN
GENERATESERIES(_curStartDate, _curEndDate))
Then I create a measure that counts the distinct memberships:
DistinctMembers = DISTINCTCOUNT(GeneratedTable[Member number])
Then I created a table visual with DateSold (only Year/Month) and the measure:
PBIX file can be found here: https://1drv.ms/u/s!Ancq8HFZYL_aiItDUonqIklYNkn7Nw?e=SZ73Cx
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
20 | |
18 | |
18 | |
14 | |
13 |
User | Count |
---|---|
40 | |
32 | |
22 | |
19 | |
18 |