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 requirement where i need to Use COSMOS DB to get the current and historica data to POWERBI
Solved! Go to Solution.
hi @khush19
Yes, you could try this way as below:
Step1:
In Edit Queries, add a days-between column as below:
DateTime.LocalNow()-[OrderDate]
Step2:
Change the datatype to decimal number
Step3:
Now add a conditional column as below:
if [Days difference]>=0 and [Days difference]<=1 then "last days" else "Not last day"
Note:This is my simple sample data, For your case, just use 7 instead of 1.
Step3:
Filter this column which is "Last days"
Step4(optional):
remove these new columns.
and here is my simple sample pbix file, please try it.
Regards,
Lin
hi @khush19
1. You could write custom SQL code to get data or use custom filter in edit queries
2. You could set schedule refresh for dataset, dataset will Load/reload data from datasource. The reports refresh data cache from dataset.
3. For pro licence user, they can schedule refresh 8 times a day at most, You could choose daily or weekly, then choose 8 time points at most for refresh.
Regards,
Lin
Thanks Lin,
In COSMOSDB is it possible to get lastweek data will current TIME.
I hav documents present in COSMOS DB ,in that Document I have JSON Array structure
Order{
"Amount":$10,
"OrderDate"="2019-11-15 10:55:49.000"
}
So i need sum for today and also sum for last week same day till current time:
So if today is 15/11 2:36 pm
So i need Amount for today till 2:56 and also amout for 08/11 till 2.56,is this possibe?
hi @khush19
Yes, you could try this way as below:
Step1:
In Edit Queries, add a days-between column as below:
DateTime.LocalNow()-[OrderDate]
Step2:
Change the datatype to decimal number
Step3:
Now add a conditional column as below:
if [Days difference]>=0 and [Days difference]<=1 then "last days" else "Not last day"
Note:This is my simple sample data, For your case, just use 7 instead of 1.
Step3:
Filter this column which is "Last days"
Step4(optional):
remove these new columns.
and here is my simple sample pbix file, please try it.
Regards,
Lin
Hi Lin,
Just a quick question ,I tried to get sum or any Aggregate function in COSMOSDB through POWERBI,but it always give me error:
The field "errors" of record was not found.
Can we perform the aggregation in powerbi for COSMOS?
and as you mentioned edit in Edit query mode,so when i edit in POWERBI to give me today data ,it takes a long time to filter because it has loaded all the document and then filtering on that.
can we write something like getdate() in sql query..where orderdate=getdate() in powerbi for cosmos and also get last week data through writing query?
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 |
---|---|
107 | |
105 | |
79 | |
69 | |
62 |
User | Count |
---|---|
142 | |
105 | |
103 | |
85 | |
70 |