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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
adrianonannini
Frequent Visitor

Start and End date, filtered by country.

Hello,

I have a somewhat simple data modelling:

- ReportDate (my date table)

- LocationDim (with info on countries, regions, channels)

- SalesTable

- CampaignInfo table.

 

Both CampaignInfo and SalesTable have a key that concatenates Region_Sbs_Channel, so I can know the sales from a granular and Campaign Units = CALCULATE([Units], 'Report Date'[Period] = "Campaign Period")

Then in my ReportDate table, I've added the following column:

 

Period =

VAR BenchmarkCampaignPeriodStart = FIRSTDATE(CampaignInfo[Benchmark Campaign Start])
VAR BenchmarkCampaignPeriodEnd = LASTDATE(CampaignInfo[Benchmark Campaign End])
VAR CPer =
SWITCH(TRUE(),
'Report Date'[Report Date] >= BenchmarkCampaignPeriodStart && 'Report Date'[Report Date] <= BenchmarkCampaignPeriodEnd, "Benchmark Campaign Period",

"Other")
Return CPer

 

It performs perfectly, but - when I'm dealing with multiple countries, it gets the earliers Campaign Start date and the latest Campaign End date. I needed that to be filtered by my region_sbs_channel key.

So if the US had a campaign period between 01/01/2024 and 21/01/2024, it will get me the [Units] on that period only, and in the US only. Now if the UK had a campaign period between 07/12/2023 and 31/12/2023, it would do the same for the UK only.

Can anyone give me a light?

1 REPLY 1
speedramps
Super User
Super User

We want to help you but your description is too vaugue. Please write it again clearly.

Please DON'T copy & paste your DAX that does not work and expect us to fathom what you want to do. That is a bit crazy. 😀

Please just give a simple non technical functional decscription of what you want, then let us suggest the solution. Thank you.

Provide example input data as table text (not a screen print) so we can import the data to build a solution for you.

Remove any unneeded columns which may cause confussion.

Rename columns to user friendly names.
Also provide the example desired output, with a clear step-by-step description of the process flow.
Remember not to share private data ... we don't want you to get into trouble. 😧
Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.
Try keep it simple and ask one question per ticket.
You will get a quick response if you put time, care and effort into writing clear problem descriptions.
Remember you are gerrting free expert help, so please put lots of proper effort to asking questions and providing example.

Vaugue descriptions can waste your time and ourtime.

Look foward to helping you when the above information is forthcoming

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors