Forum Discussion
Power Bi measures as rows
Hi Anonymous ,
I'm not clear about your requirement, could you please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
- Anonymous3 years agoNot applicable
Hi,
Okay.
I have table in frontend fields section as below:
and like this sum of loss and sum of profit also
In backend the table is likeI have given an example from excel
I have written logic for sales for previous month and last before month and average sales percentage for last two months based on date field,
Same logics for profit and loss alsoI’m able to show prev month sales, before prev month sales and avg sales percentage in one table chart
prev month profit, before prev month profit and avg profit percentage in one table chart
and for loss in another table chart
Like below
The below is the DAX formula I used to get Prev Month and Bef Prev Month Sales
Prev Month Sales = VAR previous_month = EOMONTH(TODAY(),-1)
RETURN
CALCULATE(
DISTINCTCOUNT('Content'[Sales]),
FILTER(
'Content',
'Content'[date] >= DATE(year(previous_month), month(previous_month), 1)
&& 'Content'[date] <= previous_month
)
)
Bef Prev Month Sales = VAR previous_month = EOMONTH(TODAY(),-2)
RETURN
CALCULATE(
DISTINCTCOUNT('Content'[Sales]),
FILTER(
'Content',
'Content'[date] >= DATE(year(previous_month), month(previous_month), 1)
&& 'Content'[date] <= previous_month
)
)
For Avg % Difference:Sales% = VAR Difference = 'Content'[Prev Month Sales] - 'Content'[Bef Prev Month Sales Sales] RETURN DIVIDE(Difference, 'Content'[Bef Prev Month Sales]) * 100
Like Same I did for Profit and Loss, in DAX
Same for Profit and loss in different table charts
But I want to show all of them in one table chart only, like below as:I want to show Sales, Profit, Loss in as a different rows in Function column,
For Prev Month , Bef Prev month and Avg % Difference columns, I have to show respective sales, profit and loss values in respective rows
Please give solutionThanks in advance