Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Suppose I have this:
| Member | Start | End |
| member1 | 1/1/2019 | 1/5/2019 |
| member1 | 1/1/2019 | 1/5/2019 |
| member1 | 1/1/2019 | 1/6/2019 |
| member2 | 3/1/2019 | 3/2/2019 |
| member2 | 3/1/2019 | 3/3/2019 |
This table reflects six distinct dates for member1: 1/1/19, 1/2/19, 1/3/19, 1/4/19, 1/5/19, and 1/6/19.
..and three distinct dates for member2: 3/1/19, 3/2/19, 3/3/19
Is it possible to create a Measure to compute something like this?
The measure would compute the number of distinct dates per member, based on the Start and End date.
I've been working on this for hours - any ideas would be appreciated.
Thanks!
Brian
Solved! Go to Solution.
try to create a table
Table Calendar =
ADDCOLUMNS(
crossjoin(calendar(min('Table'[Start]);max('Table'[End]));distinct('Table'[Member]));
"is in day";if(calculate(count('Table'[Member]);filter('Table'; 'Table'[Start]<=[Date] && 'Table'[End] >= [Date] && EARLIER('Table'[Member])=[Member]))>0;1;0)
)then just summarize it:
Table Total = summarize('Table Calendar';'Table Calendar'[Member];"Count";SUM('Table Calendar'[is in day]))
do not hesitate to give a kudo to useful posts and mark solutions as solution
Hi @bricohen1
Try something like this.
Measure =
CALCULATE(
DATEDIFF(
MIN( 'Table'[Start] ),
MAX( 'Table'[End] ),
DAY
),
ALL( 'Table' ),
VALUES( 'Table'[Member] )
)
Hi @bricohen1
what exactly result do you expect?
anyway try a measure
Measure =
DATEDIFF(CALCULATE(MIN('Table'[Start]);ALLEXCEPT('Table';'Table'[Member]));CALCULATE(MAX('Table'[END]);ALLEXCEPT('Table';'Table'[Member]));DAY)
do not hesitate to give a kudo to useful posts and mark solutions as solution
@az38 thanks for working on it. Using DATEDIFF is a good idea, but it's not quite right.
With the above example,
Member1 = 6.
Member2 = 3.
Brian
So, @bricohen1
Measure =
DATEDIFF(CALCULATE(MIN('Table'[Start]);ALLEXCEPT('Table';'Table'[Member]));CALCULATE(MAX('Table'[END]);ALLEXCEPT('Table';'Table'[Member]));DAY)+1
do not hesitate to give a kudo to useful posts and mark solutions as solution
try to create a table
Table Calendar =
ADDCOLUMNS(
crossjoin(calendar(min('Table'[Start]);max('Table'[End]));distinct('Table'[Member]));
"is in day";if(calculate(count('Table'[Member]);filter('Table'; 'Table'[Start]<=[Date] && 'Table'[End] >= [Date] && EARLIER('Table'[Member])=[Member]))>0;1;0)
)then just summarize it:
Table Total = summarize('Table Calendar';'Table Calendar'[Member];"Count";SUM('Table Calendar'[is in day]))
do not hesitate to give a kudo to useful posts and mark solutions as solution
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 14 | |
| 9 | |
| 5 | |
| 5 |