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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Krishna_Newuser
Helper III
Helper III

Current Reporting Month To be shown in Card

I have the data from May 2023 to till date and I need to show the average current month data in the card visual. Data will have the Transaction date, Adoption % and the store list. The report will be refreshed on a daily basis, but it have data 1 week prior to the current week. (If the report is refreshed on 3rd June, the data available in the report is 26th may to 1st June but we consider that as 26th May data).  The requirement is showing recent month data, I used the Current Month formula to show the data it worked perfectly until May 31st, when it refreshed on June 1st it shows no data available.
I need help to show the current month data in the card visual with the available data in the report.
For example, Data available in the report till May 2024 when the data refreshed on 1st June it has to show the current available data (Month).

Used Dax = 

Current Month = CALCULATE(AVERAGE('Adoption Trend_Dup'[NewAdoption]), FILTER('Adoption Trend_Dup', MONTH('Adoption Trend_Dup'[TxnDt]) = MONTH(NOW()) && YEAR('Adoption Trend_Dup'[TxnDt]) = YEAR(NOW())))
 
 
StoreNameStoreNoTxn DtNew Adoption
AA115th May 202410
BB225th May 202420
CC335th May 202430
AA1112th May 202450
BB2212th May 202410
CC3312th May 202425
AA1119th May 2024100
BB2219th May 202495
CC3319th May 202436
AA1126th May 202455
BB2226th May 202466
CC3326th May 2024100
Total   49.75
    
2 ACCEPTED SOLUTIONS

Ok. Here is a pbix file that has your example data. I created two measures and a calculated column and ended up with the values you are looking for.

jgeddes_0-1718113423336.png

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

Hi @Krishna_Newuser ,

I think this happens because you have data from multiple years.

vzhouwenmsft_0-1718330846866.png

The following DAX expression does not take the year into consideration, the maximum month is 6, and the data for 2023 and 2024 are calculated.

vzhouwenmsft_1-1718331000949.png

The Table data is shown below:

vzhouwenmsft_2-1718331214901.png

Use the following DAX expression to create a measure

Measure = 
VAR _summarizeTable = ADDCOLUMNS(SUMMARIZE('Table','Table'[Txn Dt],"average",AVERAGE('Table'[New Adoption])),"month",MONTH([Txn Dt]),"year",YEAR([Txn Dt]))
VAR _maxMonthNumber = MONTH(MAX('Table'[Txn Dt]))
VAR _maxYearNumber = YEAR(MAX('Table'[Txn Dt]))
VAR _rowscount = COUNTROWS(FILTER(_summarizeTable,[month] = _maxMonthNumber && [year] = _maxYearNumber))
VAR _averageOfNewAdoption = SUMX(FILTER(_summarizeTable,[month] = _maxMonthNumber && [year] = _maxYearNumber),[average])
RETURN DIVIDE(_averageOfNewAdoption,_rowscount,0)

Final output

vzhouwenmsft_3-1718331303211.png

If the error persists, can you share the .pbix file without the sensitive data?

 

Best Regards,
Wenbin Zhou
If this post helps,Please mark me and @jgeddes  as the solution.

View solution in original post

19 REPLIES 19
jgeddes
Super User
Super User

If you have your date column formatted as above like '5th May 2024' you will need to change it to an acutal date format for it to work. 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@jgeddes 
I cannot change the format of the data as the report refresh only on weekly basis and it will have only the weekly data. We are using the Power Automate to save the historical data in one of excel which have these format. 
Is there anything else we can do to make the changes.

Thank you for understanding!!!

Are you importing the data or is it coming in via Direct Query?




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi,

Data is available in the sharepoint and in CSV format, we are just importing the data.

I used the below query which you have asked to modify it, below is the screenshot of the error. It didnt worked, unable to figure it out to make any changes here.

Check = CALCULATE(AVERAGE('Adoption Trend_Dup'[NewAdoption]), FILTER('Adoption Trend_Dup', MONTH('Adoption Trend_Dup'[TxnDt]) = MONTH(MAXX(ALL('Adoption Trend_Dup'), 'Adoption Trend_Dup'[TxnDt])) && YEAR(MAXX('Adoption Trend_Dup'), 'Adoption Trend_Dup'[TxnDt]))))

Krishna_Newuser_0-1718092530469.png

i used this query and its showing the value as 49% but based on june 2024 it has to be 47.

Check = CALCULATE(AVERAGE('Adoption Trend_Dup'[NewAdoption]), FILTER('Adoption Trend_Dup', MONTH('Adoption Trend_Dup'[TxnDt]) = MONTH(MAXX(ALL('Adoption Trend_Dup'), 'Adoption Trend_Dup'[TxnDt])) && YEAR(MAXX('Adoption Trend_Dup', 'Adoption Trend_Dup'[TxnDt]))))




Krishna_Newuser_1-1718092827399.pngKrishna_Newuser_2-1718092846735.png

 

I may be misunderstanding a bit. Where are you getting June data from? In your original post you provided data that falls entirely in May. 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





This week data is refreshed. Now june 2nd data available.
For E:G, If the data is refreshed on 1st July 2024, the data will have the details of 23rd June 2024. In that period, it should give the data of overall % of  inclusive June month instead of 1st July.
Likewise when the data refreshed on 8th July, it will have 30th June and all this data will be considered under June Month.
When the data is refreshed on 15th July, it will have the data of 8th July. Hence it will be considered under July Month Data. It has to automatically update the July data in the card.

Ok. Thank you for the clarification. That is what I understund initially. Can you share a sample of the new June data in the same format as your original post? Otherwise I will not be able to troubleshoot why the June results do not align.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hello,

Please find the below data,

StoreNameStoreNoTxn DtNew Adoption
AA115th May 202410%
BB225th May 202420%
CC335th May 202430%
AA1112th May 202450%
BB2212th May 2024100%
CC3312th May 202425%
AA1119th May 2024100%
BB2219th May 202495%
CC3319th May 202436%
AA1126th May 202455%
BB2226th May 202466%
CC3326th May 2024100%
AA112nd June 202488%
BB222nd June 202425%
CC332nd June 202433%

 

May 
Total 49.75%

 

June
Total 49%

Ok. Here is a pbix file that has your example data. I created two measures and a calculated column and ended up with the values you are looking for.

jgeddes_0-1718113423336.png

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi,
Thank you for the help!!! When i added the whole data in the PBIX which you shared, its providing the result of 49%. I have used the same measure which you have given, if we added the overall data, i think some challenge occurs.
Date Converstion not required since my date format is already updated in Long date format.

Krishna_Newuser_0-1718173063957.png

Krishna_Newuser_1-1718173151365.png

Krishna_Newuser_2-1718173245071.png

 

If you replace all instances of the DateConversion column in my measure with the TxnDt column in your set it "should" work.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Though i have the same data format, do i need to create the data conversion?
If so, i have done that but it shows error.

Krishna_Newuser_2-1718202050545.pngKrishna_Newuser_3-1718202078145.png

 

Hi @jgeddes ,thank you for your quick reply, I think your answer is correct.

Hi @Krishna_Newuser ,

The answer is no. Column 'TxnDt' initially has a data type of 'Text'. This does not allow filtering of the data. So need to create column 'data conversion' with data type 'Date'. You mentioned that you have converted the data type of column 'TxnDt' to 'Date'. This will work. Regarding the error in your image, 'Left','Find','Right' are text functions, but the data type of column 'TxnDt' has been converted to 'Date'. Please mark @jgeddes 's answer as a solution.

Hello,

Thank you for the reply. Request you to check on the previous response, i have used the 1 year data which i have in the system by trying the measue which updated in the report. It shows the overall % of 49 instead of 47. Can you help on this please.

 

Krishna_Newuser_0-1718270530547.png

 

Hi @Krishna_Newuser ,

I think this happens because you have data from multiple years.

vzhouwenmsft_0-1718330846866.png

The following DAX expression does not take the year into consideration, the maximum month is 6, and the data for 2023 and 2024 are calculated.

vzhouwenmsft_1-1718331000949.png

The Table data is shown below:

vzhouwenmsft_2-1718331214901.png

Use the following DAX expression to create a measure

Measure = 
VAR _summarizeTable = ADDCOLUMNS(SUMMARIZE('Table','Table'[Txn Dt],"average",AVERAGE('Table'[New Adoption])),"month",MONTH([Txn Dt]),"year",YEAR([Txn Dt]))
VAR _maxMonthNumber = MONTH(MAX('Table'[Txn Dt]))
VAR _maxYearNumber = YEAR(MAX('Table'[Txn Dt]))
VAR _rowscount = COUNTROWS(FILTER(_summarizeTable,[month] = _maxMonthNumber && [year] = _maxYearNumber))
VAR _averageOfNewAdoption = SUMX(FILTER(_summarizeTable,[month] = _maxMonthNumber && [year] = _maxYearNumber),[average])
RETURN DIVIDE(_averageOfNewAdoption,_rowscount,0)

Final output

vzhouwenmsft_3-1718331303211.png

If the error persists, can you share the .pbix file without the sensitive data?

 

Best Regards,
Wenbin Zhou
If this post helps,Please mark me and @jgeddes  as the solution.

Thank you so much for the help. its working fine now, hope it will be working when the july month refresh occurs. 

jgeddes
Super User
Super User

You can try the following and see if it gives you your desired result.
Instead of MONTH(NOW()) and YEAR(NOW()) you can use MONTH(MAXX(ALL('Adoption Trend_Dup'), [TxnDt])) and YEAR(MAXX(ALL('Adoption Trend_Dup'), [TxnDt])).

This will take the month and year from the max date that exists in your table.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@jgeddes  @amitchandak 

@v-yangliu-msft 

Can someone from the group help on this issue please. 

Hello,

Thank you for the reply, i have tried the DAX, it didnt worked. 

Current Month = CALCULATE(AVERAGE('Adoption Trend_Dup'[NewAdoption]), FILTER('Adoption Trend_Dup', MONTH('Adoption Trend_Dup'[TxnDt]) = MONTH(MAX(ALL('Adoption Trend_Dup'), 'Adoption Trend_Dup'[TxnDt]))))

Current Month = CALCULATE(AVERAGE('Adoption Trend_Dup'[NewAdoption]), FILTER('Adoption Trend_Dup', MONTH('Adoption Trend_Dup'[TxnDt]) = MONTH(MAX(ALL('Adoption Trend_Dup'[TxnDt]))))

Current Month = CALCULATE(AVERAGE('Adoption Trend_Dup'[NewAdoption]), FILTER('Adoption Trend_Dup', MONTH(MAXX(ALL('Adoption Trend_Dup', 'Adoption Trend_Dup'[TxnDt])))))

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.