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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
sarath_chandra
Helper III
Helper III

DAX help

I have charge date (which is first day of each month) as column , and month wise column (first day of each month ) and stocks column.

 

i need if i select one month in date slicer (charge date) for example(01/03/2018) .

it should show future stocks value from stock column from 01/03/2018(month wise column) to 01/12/2018 (month wise column). (blue colour mentioned in future stock)

and it should show actual stock value from stock column - previous month of (month wise column) (01/01/2018 and 01/02/2018)(blue colour mentioned in actual stock )

and it dynamically take the values from previous month of selected charge date for future stock (mentioned in yellow colour )

 

i want to show it in line chart (actual stock and future stock).

please help me out 🙏

The data is attached

input.jpg

 

the desired output i need is 

 

output.jpg

1 ACCEPTED SOLUTION
v-xinruzhu-msft
Community Support
Community Support

Hi @sarath_chandra 

 You can create two measures:

Actual_ = IF(SELECTEDVALUE('Table (3)'[month-wise])<SELECTEDVALUE('Table (3)'[charge_date]),SUM([stocks]),0)

Future_ = IF(SELECTEDVALUE('Table (3)'[month-wise])>=SELECTEDVALUE('Table (3)'[charge_date]),SUM([stocks]),SUMX(FILTER(ALL('Table (3)'),'Table (3)'[month-wise]=SELECTEDVALUE('Table (3)'[month-wise])&&'Table (3)'[charge_date]=SELECTEDVALUE('Table (3)'[charge_date])-1),[stocks]))

 

vxinruzhumsft_0-1670313274932.png

 

 

 

Best Regards,

Yolo Zhu

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

2 REPLIES 2
v-xinruzhu-msft
Community Support
Community Support

Hi @sarath_chandra 

 You can create two measures:

Actual_ = IF(SELECTEDVALUE('Table (3)'[month-wise])<SELECTEDVALUE('Table (3)'[charge_date]),SUM([stocks]),0)

Future_ = IF(SELECTEDVALUE('Table (3)'[month-wise])>=SELECTEDVALUE('Table (3)'[charge_date]),SUM([stocks]),SUMX(FILTER(ALL('Table (3)'),'Table (3)'[month-wise]=SELECTEDVALUE('Table (3)'[month-wise])&&'Table (3)'[charge_date]=SELECTEDVALUE('Table (3)'[charge_date])-1),[stocks]))

 

vxinruzhumsft_0-1670313274932.png

 

 

 

Best Regards,

Yolo Zhu

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

@v-xinruzhu-msft @hi ,great hatsoff for your solution. I need difference between actuals and future stocks in seperate column as difference. but that difference should be upto selected charge date (for example ,if I select 1/3/2018 in charge date ,difference column should show upto previous month 1/2/2018 ).please help me out

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.