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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
RashmiRGowda
New Member

Calculated column doesn't show data.

I have created a calculated column with the below DAX, it doesn't show error but not showing data.

 

TimeCategory =
IF (
'Onyx Data -DataDNA Dataset Chal'[Time (bins)] = TIME (00,00,00),
"Midnight",
IF (
'Onyx Data -DataDNA Dataset Chal'[Time (bins)] = TIME (04,00,00),
"EarlyMorning",
IF (
'Onyx Data -DataDNA Dataset Chal'[Time (bins)] = TIME (08,00,00),
"Morning",
IF (
'Onyx Data -DataDNA Dataset Chal'[Time (bins)] = TIME (12,00,00),
"Noon",
IF (
'Onyx Data -DataDNA Dataset Chal'[Time (bins)] = TIME (16,00,00),
"Evening",
IF (
'Onyx Data -DataDNA Dataset Chal'[Time (bins)] = TIME (20,00,00),
"Night"
)
)
)
)
)
)

 

 

RashmiRGowda_0-1703069378114.pngRashmiRGowda_1-1703069396637.png

 

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@RashmiRGowda Verify that your Time (bins) column is set to a Time data type and not anything else. Also, I would use SWITCH instead of nested IF statements. I created a mock-up of this and was able to get your code to work just fine. Could potentially try something like:

Column = 
SWITCH( TRUE(),
  'Onyx Data -DataDNA Dataset Chal'[Time (bins)] < TIME (04,00,00), "Midnight",
  'Onyx Data -DataDNA Dataset Chal'[Time (bins)] < TIME (08,00,00), "EarlyMorning",
  'Onyx Data -DataDNA Dataset Chal'[Time (bins)] < TIME (12,00,00), "Morning",
  'Onyx Data -DataDNA Dataset Chal'[Time (bins)] < TIME (16,00,00), "Noon",
  'Onyx Data -DataDNA Dataset Chal'[Time (bins)] < TIME (20,00,00), "Evening",
  "Night"
)

PBIX is attached below signature.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
CoreyP
Solution Sage
Solution Sage

Try using a switch statement...eg)

TimeCategory = 
SWITCH( TRUE() , 
[TImeBins] = TIME( 12, 00, 00 ) , "Noon" ,
[TImeBins] = TIME( 00, 00, 00 ) , "Midnight" ,
etc... ,
BLANK()
)

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors