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.
Solved! Go to Solution.
Hi @6Rastaman9 ,
Please update the formula of measure [# of Cases (RoleDate)] as below and check if you can get the correct result...
# of Cases (RoleDate) =
VAR _seldate =
SELECTEDVALUE ( 'Calendar'[Date] )
RETURN
CALCULATE (
DISTINCTCOUNT ( MainData[CaseNumber] ),
FILTER (
MainData,
MainData[RoleStartDate] <= _seldate
&& COALESCE ( MainData[RoleEndDate], TODAY () ) >= _seldate
)
)
If the above one can't help you get the desired result, please provide some sample data in your table 'MainData' (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Thanks, very informative but not sure its what I need in this senerio. I may not be expressing it accurately.
I used your formula below which worked! but bc I now have mutiple rows of the same case # in my fact table, this formula is counting each row, therefore the same case # is being counted multiple times.
In my table I need to count distinct cases equalling 2 total cases in 2020 (start date) and those same 2 total cases in 2021 (end in 2021 so still counted as cases). I do have a Date table as well.
Here is what I used, how do I now calculate the distinct cases? ANY help would so be appreciated.
Hi @6Rastaman9 ,
Please update the formula of measure [# of Cases (RoleDate)] as below and check if you can get the correct result...
# of Cases (RoleDate) =
VAR _seldate =
SELECTEDVALUE ( 'Calendar'[Date] )
RETURN
CALCULATE (
DISTINCTCOUNT ( MainData[CaseNumber] ),
FILTER (
MainData,
MainData[RoleStartDate] <= _seldate
&& COALESCE ( MainData[RoleEndDate], TODAY () ) >= _seldate
)
)
If the above one can't help you get the desired result, please provide some sample data in your table 'MainData' (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
@v-yiruan-msft it works! Thank you so so much :).
2 follow up Qs if I may:
1 - I noticed that the # of cases doesnt total:
2 - Is it because I do not have a date hierarchy that I cant get the totals for just January or just the year? Choosing 2022 shows a Blank in a card visual.
Hi @6Rastaman9 ,
You can create a measure as below and put this measure on the card visual to replace the original measure [# of Cases (RoleDate)] and check if it can return the expected result...
Measure =
SUMX (
GROUPBY ( 'Calendar', 'Calendar'[Year], 'Calendar'[Month], 'Calendar'[Date] ),
[# of Cases (RoleDate)]
)
Best Regards
@6Rastaman9 , You can have a separate year table and use the way given below
Between Dates - Dates between
Measure way
Power BI Dax Measure- Allocate data between Range: https://youtu.be/O653vwLTUzM
https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-o...
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 |
---|---|
41 | |
21 | |
21 | |
14 | |
13 |
User | Count |
---|---|
43 | |
36 | |
33 | |
18 | |
18 |