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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
AutyDA
Helper I
Helper I

Lookup based upon multiple slicers to provide narrative

Hi,

 

I'm new to power BI and need a bit of help.

 

I have a set of annual and quartlerly data for several years for various companies. My objective is to allow the user to select a period, a company and yearly / quarterly to filter this and provide text commentary (see below). With smart narrative this works but the results are unreliable and so I want to control the narrative using text boxes.

 

AutyDA_2-1725774709002.png

 

 

As shown above I have set up measures using max and min on the dates to identify the start and end dates. What I can't do is use a lookup to get the global revenue on the selected date or identify if it has grown or fallen and by how much by numeric value and percentage.

 

AutyDA_3-1725775065071.png

 

Any help appreciated.

1 ACCEPTED SOLUTION

Hi,

 

This was a help. In the end I simplified things and reposted and found a good solution which is posted here... Solved.

 

Thanks

View solution in original post

6 REPLIES 6
v-fenling-msft
Community Support
Community Support

Hi, @AutyDA 

Thanks for Ritaf1983's concern about this issue.

 

I am glad to help you.

 

The first thing you need to know is that your Global Revenue is affected by all Slicers together. If you want to return to Global Revenue in 2021, you will need to select the Date Slicer in the 2021 timeframe as well:

 

vfenlingmsft_0-1725953114950.png

vfenlingmsft_1-1725953203659.png

 

Secondly, unfortunately, the Global Revenue you get after selecting a Slicer is not saved, so you can't directly compare the Global Revenue you get for different time periods for the Slicer selection.

 

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

This was a help. In the end I simplified things and reposted and found a good solution which is posted here... Solved.

 

Thanks

AutyDA
Helper I
Helper I

Hi, I have added a link to the pbix file. Once again my aim is obtain the global revenue on the dates specified by the slider, then identify if global revenue has grown or fallen in this period and by how much both numerically and by percentage. I would report all of this in the text box highlighted in yellow.

 

SampleData.pbix 

AutyDA
Helper I
Helper I

Unfortunately I'm restricted from uploading any files and so I'll add a data table which you can hopefully copy and paste. This is my source table:

 

Company No.YearQuarter or YearDateOperating MarginNet Profit MarginGlobal RevenueStock Price
12020Year12/31/202022.61%4.34% $               4,395,40755
12021Year12/31/20216.46%7.12% $               3,514,20644
12022Year12/31/202213.57%15.83% $               7,568,49222
12023Year12/31/202328.92%10.21% $               4,331,90384
12024Year12/31/202425.00%13.00% $               5,324,00074
22020Year12/31/20205.00%7.00% $               2,532,56727
22021Year12/31/20216.00%8.00% $             15,000,45233
22022Year12/31/20225.00%5.00% $               2,703,53536
22023Year12/31/20237.00%22.00% $               3,476,52435
22024Year12/31/20245.00%5.00% $               4,232,22139
32020Year12/31/20204.98%-48.01% $             20,705,000123
32021Year12/31/20217.21%-1.07% $               4,300,000143
32022Year12/31/20229.39%-2.84% $               3,550,000135
32023Year12/31/202310.37%7.62% $             25,506,000164
32024Year12/31/20249.00%8.00% $               2,400,000177
12020Q12/31/202014.28%9.78% $               1,010,94455
12021Q12/31/202111.11%1.07% $                   950,00044
12022Q12/31/20227.56%6.62% $               1,892,12322
12023Q12/31/202310.87%6.83% $                   996,33884
12024Q12/31/202414.00%7.00% $               1,224,52074
22020Q12/31/20203.99%-20.39% $                   582,49027
22021Q12/31/202111.38%9.53% $               3,546,85233
22022Q12/31/202214.80%7.75% $                   621,81336
22023Q12/31/202317.74%11.46% $                   800,00035
22024Q12/31/202413.00%33.00% $                   973,41139

 

Then I have a Dax Date Table with an active relationship in model view being set up between Date in each table:

 

DAX DateTable =
ADDCOLUMNS (
    //CALENDAR(DATE(2014,1,1), DATE(2030,12,31)),
    CALENDARAUTO(),
    "Year", YEAR([Date]),
    "Quarter", "Q" & FORMAT(CEILING(MONTH([Date])/3, 1), "#"),
    "Quarter No", CEILING(MONTH([Date])/3, 1),
    "Month No", MONTH([Date]),
    "Month Name", FORMAT([Date], "MMMM"),
    "Month Short Name", FORMAT([Date], "MMM"),
    "Month Short Name Plus Year", FORMAT([Date], "MMM,yy"),
    "DateSort", FORMAT([Date], "yyyyMMdd"),
    "Day Name", FORMAT([Date], "dddd"),
    "Details", FORMAT([Date], "dd-MMM-yyyy"),
    "Day Number", DAY ( [Date] ))
 
I made 3 slicers for (1) Company No. (2) Quarter or Year and (3) Date using a between slicer. I then created a measure to calculate the start and end dates (StartDate = min('DAX DateTable'[Date]), EndDate = max('DAX DateTable'[Date])) established by the Date slicer.
 
What I want is if a user selects Company No.1, Year, starting 2021 the global revenue in 2021 for company 1 is returned - i.e.  $ 3,514,206. If the user selects Company No.1, Quarter, starting 2021 the Quarterly global revenue in 2021 for company 1 is returned - i.e. $ 950,000.
 
I hope that makes sense. Thanks.
AutyDA
Helper I
Helper I

Here is a sample of my data: 

 

Company No.YearQuarter or YearDateOperating MarginNet Profit MarginGlobal RevenueStock Price
12020Year12/31/202022.61%4.34% $               4,395,40755
12021Year12/31/20216.46%7.12% $               3,514,20644
12022Year12/31/202213.57%15.83% $               7,568,49222
12023Year12/31/202328.92%10.21% $               4,331,90384
12024Year12/31/202425.00%13.00% $               5,324,00074
22020Year12/31/20205.00%7.00% $               2,532,56727
22021Year12/31/20216.00%8.00% $             15,000,45233
22022Year12/31/20225.00%5.00% $               2,703,53536
22023Year12/31/20237.00%22.00% $               3,476,52435
22024Year12/31/20245.00%5.00% $               4,232,22139
32020Year12/31/20204.98%-48.01% $             20,705,000123
32021Year12/31/20217.21%-1.07% $               4,300,000143
32022Year12/31/20229.39%-2.84% $               3,550,000135
32023Year12/31/202310.37%7.62% $             25,506,000164
32024Year12/31/20249.00%8.00% $               2,400,000177
12020Q12/31/202014.28%9.78% $               1,010,94455
12021Q12/31/202111.11%1.07% $                   950,00044
12022Q12/31/20227.56%6.62% $               1,892,12322
12023Q12/31/202310.87%6.83% $                   996,33884
12024Q12/31/202414.00%7.00% $               1,224,52074
22020Q12/31/20203.99%-20.39% $                   582,49027
22021Q12/31/202111.38%9.53% $               3,546,85233
22022Q12/31/202214.80%7.75% $                   621,81336
22023Q12/31/202317.74%11.46% $                   800,00035
22024Q12/31/202413.00%33.00% $                   973,41139

 

And for my date table I'm using the following DX Date Table.

 

DAX DateTable =
ADDCOLUMNS (
    //CALENDAR(DATE(2014,1,1), DATE(2030,12,31)),
    CALENDARAUTO(),
    "Year", YEAR([Date]),
    "Quarter", "Q" & FORMAT(CEILING(MONTH([Date])/3, 1), "#"),
    "Quarter No", CEILING(MONTH([Date])/3, 1),
    "Month No", MONTH([Date]),
    "Month Name", FORMAT([Date], "MMMM"),
    "Month Short Name", FORMAT([Date], "MMM"),
    "Month Short Name Plus Year", FORMAT([Date], "MMM,yy"),
    "DateSort", FORMAT([Date], "yyyyMMdd"),
    "Day Name", FORMAT([Date], "dddd"),
    "Details", FORMAT([Date], "dd-MMM-yyyy"),
    "Day Number", DAY ( [Date] ))
 
The two measures I added to this are 
 
StartDate = Min ('DAX DateTable'[Date])
EndDate = Max ('DAX DateTable'[Date])

 

I hoope this helps.

Ritaf1983
Super User
Super User

Hi @AutyDA 

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.