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

Get certified as a Fabric Data Engineer: Check your eligibility for a 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700. Get started

Reply
Krcmajster
Helper IV
Helper IV

Select values based on conditions

So I have 3 tables, one with locations and 2 with sales and dates. My dev didn't created dates tabel, so my question is:

 

Can you use dax to select columns based on condition, and that would be vendor from locations table ? e.g. if Vendor is Ven1 then use dates and sale amounts from Sales1 table and if Vendor is Ven2 then use data from Sales2. I would like to use this on axis in chart and slicer. I can't create column since it's in Azure

1 ACCEPTED SOLUTION

Hi @Krcmajster ,

 

If i understand you correctly, you can use UNION() function to create a calculated table which contains table1 and table2 then use vendor as silcer if you want.

2.PNG

3.PNG

4.PNG

5.PNG

6.PNG

7.PNG

 

Best Regards,

Jay

 

Community Support Team _ Jay Wang

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

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

View solution in original post

5 REPLIES 5
VasTg
Memorable Member
Memorable Member

@Krcmajster 

 

I can't create column since it's in Azure

 

A measure cannot be used in in a chart or slicer. It has to be a column.

 

where are you creating the report? Is your source a dataset?

 

If it helps, mark it as a solution

Kudos are nice too

Connect on LinkedIn
jstorm
Resolver III
Resolver III

If the tables are related you could use an IF() based on your vendor.  For example:


IF( [vendor] = "Ven1",
    CALCULATE( SUM( 'Sales1'[Sales] ), 'Sales1'[Dates] ),
    CALCULATE( SUM( 'Sales2'[Sales] ), 'Sales2'[Dates] )
)

(If the vendor is "Ven1" uses first calculate function with Sales1 table, else, use second calculate with Sales2 table.)

shebr
Resolver III
Resolver III

Hi @Krcmajster 

 

I believe this is possible, can you provide a subset of data so that I can look at a relevant measure? I I need a bit more information about the vendor and sales values and how they are currently stored.

 

Thanks

 

 

Capture.JPG

 

@shebr Best I could do. The tables are not the same and the connection is more complicted but I can solve this if I have solution for this

Hi @Krcmajster ,

 

If i understand you correctly, you can use UNION() function to create a calculated table which contains table1 and table2 then use vendor as silcer if you want.

2.PNG

3.PNG

4.PNG

5.PNG

6.PNG

7.PNG

 

Best Regards,

Jay

 

Community Support Team _ Jay Wang

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

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

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! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.