cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
leudyston Regular Visitor
Regular Visitor

Create Measure Stock Balance

Hello my friends, I'm breaking my head with this measure, I need to calculate the stock balance(SALDO), grouping by store(idiloja), product(iditem) and date mov(iddata_movimento). In database, I got sucess with this consult. How do I create this measure in DAX?database

In attachment i have make a test pbix file.

File PBIX



Thanks

print.jpg

 

Leudyston

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Microsoft Phil_Seamark
Microsoft

Re: Create Measure Stock Balance

Hi @leudyston

 

I think I know what you are after but not sure.  Is this close as a calculated measure?

 

Running Balance = CALCULATE(
				SUM('fmovimentos'[mov_estoque])
				,FILTER(
					ALL('fmovimentos'),
					'fmovimentos'[idloja] = MAX('fmovimentos'[idloja])
					 && 'fmovimentos'[iditem] = MAX('fmovimentos'[iditem])
					 && 'fmovimentos'[iddata_movimento] <= MAX('fmovimentos'[iddata_movimento])
					)
				)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

Microsoft v-yulgu-msft
Microsoft

Re: Create Measure Stock Balance

Hi @leudyston,

 

Have you achieved your desired result with Phil_Seamark's suggestion? If yes, would you please accept his reply as a solution so that others can find the answer more easily? 

 

"I need to simulate this image report, in a PivotTable in PivotTable. I found that getting to the BALANCE by product would be able to use the same measure for other contexts. Can you help me?" I'm not clear about this requirement. Is it related to the original one? If yes, please provide more description about it so that I can test for you. If it is a new request, please post your question as a new thread so that more community members can view it.

 

By the way, to help us better understand your table structure and protect your sensitive data, please simplify your sample data posted here.

 

Regards,

Yuliana Gu

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

View solution in original post

5 REPLIES 5
leudyston Regular Visitor
Regular Visitor

Create Measure Stock Balance

https://mega.nz/#!QY1lXDoQ!8-c8qyvgNYa7HVzxdV---3-MQQOpyKchieMGHGe-CLk

 

Hello my friends, I'm breaking my head with this measure, I need to calculate the stock balance(SALDO), grouping by store(idiloja), product(iditem) and date mov(iddata_movimento). In database, I got sucess with this consult. How do I create this measure in DAX?database

 

In attachment i have make a test pbix file.

 

Thanks

Leudyston



Highlighted
Microsoft Phil_Seamark
Microsoft

Re: Create Measure Stock Balance

Hi @leudyston

 

I think I know what you are after but not sure.  Is this close as a calculated measure?

 

Running Balance = CALCULATE(
				SUM('fmovimentos'[mov_estoque])
				,FILTER(
					ALL('fmovimentos'),
					'fmovimentos'[idloja] = MAX('fmovimentos'[idloja])
					 && 'fmovimentos'[iditem] = MAX('fmovimentos'[iditem])
					 && 'fmovimentos'[iddata_movimento] <= MAX('fmovimentos'[iddata_movimento])
					)
				)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

leudyston Regular Visitor
Regular Visitor

Re: Create Measure Stock Balance

Hello Phil, thank you for your attention !!

 

This workaround works when I do not use filters in context. When I use the filters, the result changes and takes a long time to appear. I need to simulate this image report, in a PivotTable in PivotTable. I found that getting to the BALANCE by product would be able to use the same measure for other contexts. Can you help me?

 

REPORT.png

 

pbi.jpg

 

 

 

Microsoft v-yulgu-msft
Microsoft

Re: Create Measure Stock Balance

Hi @leudyston,

 

Have you achieved your desired result with Phil_Seamark's suggestion? If yes, would you please accept his reply as a solution so that others can find the answer more easily? 

 

"I need to simulate this image report, in a PivotTable in PivotTable. I found that getting to the BALANCE by product would be able to use the same measure for other contexts. Can you help me?" I'm not clear about this requirement. Is it related to the original one? If yes, please provide more description about it so that I can test for you. If it is a new request, please post your question as a new thread so that more community members can view it.

 

By the way, to help us better understand your table structure and protect your sensitive data, please simplify your sample data posted here.

 

Regards,

Yuliana Gu

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

View solution in original post

leudyston Regular Visitor
Regular Visitor

Re: Create Measure Stock Balance

Okay, I will create a new thread 

 

Thanks.

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors