Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello, can you please help for below 2 queries.
1.) I have Year & YYYYMM slicers. How can I show the sum of sales for last year-1 when I select Year & YYYYMM in slicers. Year is single select & YYYYMM is multi select. If I chose 2024 in Year and 202401, 202402 in YYYYMM, I need the KPI card LY measure to show value for Year 2022 & YYYYMM IN 202201, 202202 depending on how many YYYYMM I select from the slicer. I have date, Year, YYYYMM, YYYYMM-1, YYYYMM-2 columns in dim_calendar table. Using SAMPERIODLASTYEAR function I have calculated sales for last year but I need Lastyear - 1 sales for the same period. Data below.
2.) I am unable to capture the values especially when multiple YYYYMM integer values are selected. When I create a measure I am unable to use VALUES and IN functions since the measure allows only 1 value as output. How to capture selected values in slicer and pass it to a variable or a table.
Solved! Go to Solution.
Hi,
I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
Sales: =
SUM( sales[sales] )
Previous Year Sales: =
CALCULATE([Sales:], SAMEPERIODLASTYEAR('calendar'[Date]))
Previous Year - 1 Sales: =
CALCULATE([Previous Year Sales:], SAMEPERIODLASTYEAR('calendar'[Date]))
Selected period sales: =
VAR _selectedlist =
VALUES ( 'calendar'[YearMonth] )
RETURN
CALCULATE (
[Sales:],
FILTER ( ALL ( 'calendar' ), 'calendar'[YearMonth] IN _selectedlist )
)
Hi @varung8899 ,
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please accept it as a solution and give it a 'Kudos' so other community members with similar problems can find a solution faster.
Thank you.
Regards,
Rama U.
Hi @varung8899 ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
Regards,
Rama U.
Hi @varung8899 ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Regards,
Rama U.
Hi,
I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
Sales: =
SUM( sales[sales] )
Previous Year Sales: =
CALCULATE([Sales:], SAMEPERIODLASTYEAR('calendar'[Date]))
Previous Year - 1 Sales: =
CALCULATE([Previous Year Sales:], SAMEPERIODLASTYEAR('calendar'[Date]))
Selected period sales: =
VAR _selectedlist =
VALUES ( 'calendar'[YearMonth] )
RETURN
CALCULATE (
[Sales:],
FILTER ( ALL ( 'calendar' ), 'calendar'[YearMonth] IN _selectedlist )
)
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
13 | |
11 | |
9 | |
6 |