Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
khush19
Resolver I
Resolver I

Push Dataset in powerBI

I have a requirement where data from Event Hub is continuously coming to Stream Analytics and I am pushing it to POWERBI with a tumbling window of 15 mins.The Push data set will have data for a week.

The data is Transaction data where I have Amount and Transaction Date

For my requirement i need 3 charts

  1. total Amount for today till current time ..SO suppose 04th Nov (6:41 pm) it is $100
  2. change in Amount (Total Amount last week same day till same time- total Amount for today till current time) --Suppose last week it is 28 Oct till 6:41 pm it was @$80 so it should show @$20
  3. a KPI where it find percentage difference between first two. 20*100/100=20%

as I am using the tumbling window of 15 mins so i wont have transaction exactly till 6:41 but at least Amount where Max(Transaction Date)<= CurrentTime (6:41) for that day .

I am not sure how can I achieve 2nd and 3rd?

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @khush19 

If you can use Power BI Desktop to push data and achieve your requirement,

(there is a blog :Create a Power BI Push DataSet using Power BI Desktop w/ PowerBIPS.Tools)

also you are able to create measures in Power BI Desktop,

you could create the following measures:

date1 = DATE(YEAR(MAX('Table'[datetime])),MONTH(MAX('Table'[datetime])),DAY(MAX('Table'[datetime])))

now = NOW()

total_now = CALCULATE(SUM('Table'[amount]),FILTER(ALL('Table'),'Table'[date]=TODAY()&&'Table'[datetime]<=NOW()))

total_last week = var lastweek=TODAY()-7 return CALCULATE(SUM('Table'[amount]),FILTER(ALL('Table'),'Table'[date]=lastweek&&'Table'[datetime]<=NOW()-7))

change = [total_now]-[total_last week]

change% = [change]/[total_now]

Capture14.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-juanli-msft
Community Support
Community Support

Hi @khush19 

If you can use Power BI Desktop to push data and achieve your requirement,

(there is a blog :Create a Power BI Push DataSet using Power BI Desktop w/ PowerBIPS.Tools)

also you are able to create measures in Power BI Desktop,

you could create the following measures:

date1 = DATE(YEAR(MAX('Table'[datetime])),MONTH(MAX('Table'[datetime])),DAY(MAX('Table'[datetime])))

now = NOW()

total_now = CALCULATE(SUM('Table'[amount]),FILTER(ALL('Table'),'Table'[date]=TODAY()&&'Table'[datetime]<=NOW()))

total_last week = var lastweek=TODAY()-7 return CALCULATE(SUM('Table'[amount]),FILTER(ALL('Table'),'Table'[date]=lastweek&&'Table'[datetime]<=NOW()-7))

change = [total_now]-[total_last week]

change% = [change]/[total_now]

Capture14.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks Maggie,

 

But filter doesn't work for me.it return blank 

 
Capture.JPG

.

I tried putting Today() in different measure but no use.

When i use IF to compare date1 with today() it is correct as required but doesn't work in filter. 

Hi @khush19 

Do you use the formula as i provided?

If not, please use my formula instead or show me your formula, i think you may miss something.

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Yes,I am using your formula:

total_now = CALCULATE(SUM(WeeklyTransactionTable[RealAmount]),FILTER(ALL(WeeklyTransactionTable),WeeklyTransactionTable[date1]=Today()))
 
Infact when i check adding a measure Check=IF(WeeklyTransactionTable[date1]=Today(),"true","fasle"),it works fine.
it is just that it doesnt work in filter

Hi Maggie,

 

Thanks for your time and your answer.

Now filter is working.

So earlier I was comparing today() with a column of date which was derived from 

date1 = DATE(YEAR(MAX(WeeklyTransactionTable[MaxTransactionDateTime])),MONTH(MAX(WeeklyTransactionTable[MaxTransactionDateTime])),DAY(MAX(WeeklyTransactionTable[MaxTransactionDateTime])))
so filter was not working.
 
Then I compared Today() with one of my column of Datetime with hh:mm:ss as 00:00:00
Capture.JPG
and it worked.
 
Thanku soooooo much 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.