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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Bharathi_99
Helper V
Helper V

Power Bi measures as rows

Hi All,

 

I have created some measures in PowerBI as per the business requirement

but i can display it as different tables like below as example:

Sales:  
Feb SalesMarch Sales

Percentage diff

 

 

1.5M1.8MSome value
   
Profit:  
Feb ProfitMarch ProfitPercentage diff
1.5 M2.5Msome value
   
Loss:  
Feb LossMarch LossPercentage diff
500k200ksome value

 

 

 

I have created sales table chart from  content table in powerbi with column content_sales, profit table chart from content table with content_profit and same for loss table chart
and date is also considered from same content table 

I will include dax formula which I used for getting those measures

Feb sales = Feb Like = VAR previous_month = EOMONTH(TODAY(),-2)
RETURN
CALCULATE(
DISTINCTCOUNT('Content'[content_sales]),
FILTER(
'Fact Content',
'Content'[date] >= DATE(year(previous_month), month(previous_month), 1)
&& 'Content'[date] <= previous_month
)
)
Like this I achieved Feb profit and feb loss  and same as for march month sales, profit and loss

 

But the business want as below:

FunctionFeb MarchPercentage diff
Sales1.5M1.8Msome value
Profit1.5M2.5Msome value
Loss500k200ksome value

 

How can I achieve this please help me out...

 

Thanks in advance

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @Bharathi_99 ,

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

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

Hi,

Okay.

I have table in frontend fields  section as below:

Bharathi_99_3-1682946606197.png


and like this sum of loss and sum of profit also


In backend the table is like

Bharathi_99_2-1682946456944.png

I 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 also

I’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

Bharathi_99_1-1682946352003.png

 


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:

 

Bharathi_99_0-1682946253165.png

 

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 solution

Thanks in advance

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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