The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi,
I'm creating a measure in which I want to count monthly average of sales (With and without tax), as per Financial year. If the user select previous FY it should divide the amount by 12 if current than amount divide by (current month -1).
I have written a dax for the same in DAX query window, where it is showing me the expected output for current and previous year.
I use the same code and create a new measure and it's not showing the correct output as shown in DAX query window.
There's no page or report level filters in the dashboard. Don't know why it's not showing the correct result.
The correct result is the 1st image in DAX query view.
Can anyone please help??
@FreemanZ , @SamWiseOwl , @Dangar332 , @DataNinja777 , @Ritaf1983 , @Kedar_Pande
Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
YouTube: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
Hi, @Poojara_D12
Can you furthur clarify your requirment ?, it's hard to predict what you looking for from above description.
Hi, Wrap your existing DAX logic in a calculate function within the measure to explicitly control the context:
Monthly Average Without Tax =
VAR StartDate =
CALCULATE(
MIN('Calendar'[Date]),
'Calendar'[FiscalYear] = SelectedFiscalYear
)
VAR EndDate =
CALCULATE(
MAX('Calendar'[Date]),
'Calendar'[FiscalYear] = SelectedFiscalYear
)
VAR IsFiscalYearComplete =
MAX('Purchase Analysis'[Posting_Date]) <= EndDate
VAR SalesInFiscalYear =
CALCULATE(
SUM('Purchase Analysis'[Purchase Amount]),
'Calendar'[FiscalYear] = SelectedFiscalYear,
'Purchase Analysis'[Type] = "Item"
)
VAR MonthsInPeriod =
IF(
IsFiscalYearComplete,
12,
DATEDIFF(StartDate, TODAY(), MONTH) - 1
)
RETURN
DIVIDE(SalesInFiscalYear, MonthsInPeriod, 0)
Please share a simplified version of your PBIX file (in English) without sensitive data. You can upload it to a public cloud service like OneDrive, Google Drive, or Dropbox and share the link. This will help in understanding your data structure and the issue, allowing for more precise guidance.
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
25 | |
13 | |
13 | |
8 | |
8 |