Forum Discussion
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 =
| StoreName | StoreNo | Txn Dt | New Adoption |
| AA | 11 | 5th May 2024 | 10 |
| BB | 22 | 5th May 2024 | 20 |
| CC | 33 | 5th May 2024 | 30 |
| AA | 11 | 12th May 2024 | 50 |
| BB | 22 | 12th May 2024 | 10 |
| CC | 33 | 12th May 2024 | 25 |
| AA | 11 | 19th May 2024 | 100 |
| BB | 22 | 19th May 2024 | 95 |
| CC | 33 | 19th May 2024 | 36 |
| AA | 11 | 26th May 2024 | 55 |
| BB | 22 | 26th May 2024 | 66 |
| CC | 33 | 26th May 2024 | 100 |
| Total | 49.75 | ||
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.
- Anonymous2 years ago
Hi Anonymous ,
I think this happens because you have data from multiple years.
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.
The Table data is shown below:
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
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.
19 Replies
- jgeddes
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.
- AnonymousNot applicable
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]))))) - AnonymousNot applicable
Anonymous
Can someone from the group help on this issue please.
- jgeddes
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.
- AnonymousNot applicable
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!!!- jgeddes
Super User
Are you importing the data or is it coming in via Direct Query?