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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
susmitha
Regular Visitor

daxquery depends on dayname and controlid

depends upon dayname and controld_id as shown ijn the below screenshot ,need to write a dax querycan any one please help

 

susmitha_0-1720506576325.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @susmitha ,

 

As I can see in my screenshot, when the load is on Monday, it shows control ID 5, and if it's on Tuesday to Friday it controls ID 1, and on Saturday load, then it controls ID 3.

vtangjiemsft_0-1721705113661.png

If you only need to control the ID to appear on the visual, then you only need to place the fields you want on the visual.

vtangjiemsft_1-1721705276177.png

 

If I misunderstood what you meant, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

10 REPLIES 10
Anonymous
Not applicable

Hi @susmitha ,

 

Thanks @BeaBF  for the quick reply and solution. Please allow me to make some additions:

(1) This is my test data.  

vtangjiemsft_0-1720765591744.png

(2) We can create calculated columns.

TheDayName = FORMAT([batch_run_dt_ct],"dddd")
Controlid = SWITCH([TheDayName],
"Monday", 5,
"Sunday", 4,
"Saturday", 3,
1
)

(3) Then the result is as follows.

vtangjiemsft_1-1720765666846.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

hello @vtangile,

 

the requirement is when it's monday load it should show control id 5 and then show only that load

if its tues to friday controld id 1 ,saturday load then it control id 3 it should show only those loads in pbi report.

If you refre to the below screenshot,its showing all the control id's in the report.

susmitha_0-1721629553749.png

 

Anonymous
Not applicable

Hi @susmitha ,

 

As I can see in my screenshot, when the load is on Monday, it shows control ID 5, and if it's on Tuesday to Friday it controls ID 1, and on Saturday load, then it controls ID 3.

vtangjiemsft_0-1721705113661.png

If you only need to control the ID to appear on the visual, then you only need to place the fields you want on the visual.

vtangjiemsft_1-1721705276177.png

 

If I misunderstood what you meant, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

susmitha
Regular Visitor

@BeaBF,

depends on batchdt or batch name need to have a calculated column

 

 

susmitha_0-1720587601215.png

 

@susmitha can you share the pbix?

sry won't be able to share pbix,but as mentioned in the earlier screenshot those are the sameple data

@susmitha ok, I can't reproduce the table with a screen. If you want help, at least paste the data as if it were an Excel, thanks.

 

BBF

susmitha
Regular Visitor

@BeaBF,instead of dayname can we use run_dt.in pbi report we dont have dayname column

 

the requriement is like if its monday control_id should be 5.

@susmitha do you have sample data of power bi? on which i can calculate the correct column

 

BBF

BeaBF
Super User
Super User

@susmitha Hi!

Controlid = SWITCH([TheDayName],
"Monday", "5",
"Sunday", "4",
"Saturday", "3",
"1"
)

BBF

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.