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.
I have a resource table similar to this:
ResourceTable
ResourceName | CreationTime | DeletionTime | ResourceType | CompanyName |
N1 | 1/4/2019 | 1/1/1900 | R1 | C1 |
N2 | 2/4/2019 | 1/1/1900 | R2 | C2 |
N3 | 12/01/2018 | 01/01/2019 | R1 | C1 |
N4 | 10/01/2018 | 01/01/2019 | R3 | C1 |
N5 | 8/01/2018 | 1/1/1900 | R5 | C3 |
N6 | 6/01/2018 | 01/01/2019 | R1 | C3 |
As you can see, for a particular date 'EndDate', a resource can be called 'Active' if it satisfies the following formula:
CreationTime<=EndDate AND (DeletionTime==1/1/1900 OR DeletionTime>EndDate)
I need to calculate trends for number of creates over the period of say last 365 days.
I also need trends per ResourceType, per resourcetype per company etc
Today i am able to get trends of creates over 365 days by doing the following:
Create a new Date table Last365Days with dates of last 365 days
Create a new Column
Total Resources = CALCULATE(COUNT(ResourceTable[ResourceName]),FILTER(ResourceTable,AND(ResourceTable[CreationTime]<=Last365Days[End Date],OR(ResourceTable[DeletionTime].[Year]=1900,ResourceTable[DeletionTime]>Last365Days[End Date]))))
But since this is a calculated column on a different table, I cannot group this by ResourceType or CompanyName.
If i want that, with this approach i will have to create a new column per company name or per resource type on Last365Days table. Like this:
Total C1 Resources = CALCULATE(COUNT(ResourceTable[ResourceName]),FILTER(ResourceTable,AND(ResourceTable[CompanyName] = "C1",AND(ResourceTable[CreationTime]<=Last365Days[End Date],OR(ResourceTable[DeletionTime].[Year]=1900,ResourceTable[DeletionTime]>Last365Days[End Date])))))
Is there a better way to group per companyname/resourcetype/both without creating a new column per resource/company? Especially since company is a field that can keep having new values in future. Or is there a better way to get the data i am calculating?
Am I missing something basic?
Solved! Go to Solution.
Not sure, seems like Open Tickets: https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/td-p/409364
Can't you create a metric for Total Resources using your logic and a separate data dimension? I am not sure why we would have to store all prior dates in a separate table and calculate the count of resources created. If it's a measure, you can use any column of your choice to slice it across. Let me know if I am missing anything here about the problem statement.
The reason why i had to create a separate date table is because i want to calculate growth for every single day in last 365days. And i wanted this date to be the input towards my formula for calculating what can be called 'Active'. I was able to use one of the solutions suggested here and achieve it. Created a measure that took the date from date table as input and calculate whats active using my formula
@thecrueljoker , Check this blog can help
Not sure, seems like Open Tickets: https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/td-p/409364
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 |
---|---|
117 | |
105 | |
69 | |
67 | |
43 |
User | Count |
---|---|
148 | |
103 | |
103 | |
88 | |
66 |